12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- from wagtail.snippets.models import register_snippet
- from wagtail.snippets.views.snippets import SnippetViewSet, SnippetViewSetGroup
- from bakerydemo.breads.models import BreadIngredient, BreadType, Country
- class BreadIngredientSnippetViewSet(SnippetViewSet):
- model = BreadIngredient
- ordering = ("name",)
- search_fields = ("name",)
- inspect_view_enabled = True
- class BreadTypeSnippetViewSet(SnippetViewSet):
- model = BreadType
- ordering = ("title",)
- search_fields = ("title",)
- class CountrySnippetViewSet(SnippetViewSet):
- model = Country
- ordering = ("title",)
- search_fields = ("title",)
- class BreadMenuGroup(SnippetViewSetGroup):
- menu_label = "Bread Categories"
- menu_icon = "suitcase"
- menu_order = 200
- items = (
- BreadIngredientSnippetViewSet,
- BreadTypeSnippetViewSet,
- CountrySnippetViewSet,
- )
- register_snippet(BreadMenuGroup)
|