Snippet Types
The demo includes four main snippet types:Country
Countries of origin for bread products
BreadType
Categories for different types of bread
BreadIngredient
Individual ingredients used in bread recipes
Person
People who author blog posts and other content
Country Snippet
Model Definition
breads/models.py
Admin Registration
breads/wagtail_hooks.py
BreadType Snippet
Model Definition
breads/models.py
ViewSet with Filtering
breads/wagtail_hooks.py
BreadIngredient Snippet
Model with Draft States
breads/models.py
ViewSet with Inspection
breads/wagtail_hooks.py
Person Snippet
Advanced Model with Workflow
base/models.py
Custom ViewSet
base/wagtail_hooks.py
Snippet Groups
Define Snippet Groups
Organize related snippets together using
SnippetViewSetGroup:breads/wagtail_hooks.py
Usage in Pages
ForeignKey Relationships
breads/models.py
Many-to-Many Relationships
breads/models.py
Why Use ParentalManyToManyField?
Why Use ParentalManyToManyField?
ParentalManyToManyField from django-modelcluster allows relationships to be stored locally to the parent model until it’s explicitly saved. This enables:- Preview functionality to work correctly
- Revision tracking of relationships
- Proper handling in Wagtail’s admin interface
Best Practices
Use appropriate mixins: Choose mixins based on your needs:
DraftStateMixinfor draft/live workflowRevisionMixinfor revision historyPreviewableMixinfor preview functionalityWorkflowMixinfor approval workflowsLockableMixinfor content locking

