Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/springload/wagtailembedder
Snippets embedder for Wagtail richtext fields
https://github.com/springload/wagtailembedder
embeds python snippets wagtail
Last synced: about 2 months ago
JSON representation
Snippets embedder for Wagtail richtext fields
- Host: GitHub
- URL: https://github.com/springload/wagtailembedder
- Owner: springload
- License: mit
- Created: 2015-01-15T20:22:34.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-02-08T22:57:09.000Z (almost 2 years ago)
- Last Synced: 2024-11-13T16:11:50.498Z (2 months ago)
- Topics: embeds, python, snippets, wagtail
- Language: Python
- Homepage: https://pypi.python.org/pypi/wagtailembedder
- Size: 121 KB
- Stars: 37
- Watchers: 32
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wagtail - wagtailembedder - Snippets embedder for Wagtail richtext fields. (Apps / Rich text editor extensions)
README
# wagtailembedder [![PyPI](https://img.shields.io/pypi/v/wagtailembedder.svg)](https://pypi.python.org/pypi/wagtailembedder)
> Snippets embedder for Wagtail RichTextField.
*Check out [Awesome Wagtail](https://github.com/springload/awesome-wagtail) for more awesome packages and resources from the Wagtail community.*
![Wagtailembedder scnreenshot](./screenshot.png)
## Quickstart
Install the package with
```sh
pip install wagtailembedder
```Add `wagtailembedder` to your `settings.py` in the `INSTALLED_APPS` section:
```python
INSTALLED_APPS = [
...
'modelcluster',
'wagtailembedder',
'core',
...
]
```For each models registered as a wagtail.wagtailsnippets create an html file to render the template inside a RichText field.
* Templates names will match snippets models names replacing capital letters with underscores, Wagtail style.
For the ```SocialMediaLink``` snippet in the ```core``` app, it will look for the following template ```core/templates/snippets/socialmedialink.html```.
* The variable containing the snippet instance in the template is ```snippet```.If no template is defined then an exception will be raised in the frontend when rendering a RichTextField with the embedded snippet in it. Make sure you write some templates for your snippets before start to embedding them.
# Options
If the snippet meta has a description field, it will show up next to the snippet name in the admin interface.
```python
from django.db import models
import django.db.models.options as optionsoptions.DEFAULT_NAMES = options.DEFAULT_NAMES + ('description',)
@register_snippet
class MySnippet(models.Model):
# fields definitionclass Meta:
description = "My Snippet Description"
```## Development
### Releases
- Make a new branch for the release of the new version.
- Update the [CHANGELOG](https://github.com/springload/wagtailembedder/CHANGELOG.md).
- Update the version number in `setup.py`, following semver.
- Make a PR and squash merge it.
- Back on master with the PR merged, use `make publish` (confirm, and enter your password).
- Finally, go to GitHub and create a release and a tag for the new version.
- Done!