Implements Issue #35 with category snippets, article category routing, category-aware templates, and category RSS feeds with tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
25 lines
593 B
Python
25 lines
593 B
Python
from wagtail.snippets.models import register_snippet
|
|
from wagtail.snippets.views.snippets import SnippetViewSet
|
|
|
|
from apps.blog.models import Category, TagMetadata
|
|
|
|
|
|
class TagMetadataViewSet(SnippetViewSet):
|
|
model = TagMetadata
|
|
icon = "tag"
|
|
list_display = ["tag", "colour"]
|
|
|
|
|
|
register_snippet(TagMetadataViewSet)
|
|
|
|
|
|
class CategoryViewSet(SnippetViewSet):
|
|
model = Category
|
|
icon = "folder-open-inverse"
|
|
list_display = ["name", "slug", "show_in_nav", "sort_order"]
|
|
list_filter = ["show_in_nav"]
|
|
ordering = ["sort_order", "name"]
|
|
|
|
|
|
register_snippet(CategoryViewSet)
|