diff --git a/content/templatetags/__init__.py b/content/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/content/templatetags/categories.py b/content/templatetags/categories.py new file mode 100644 index 0000000..fb31157 --- /dev/null +++ b/content/templatetags/categories.py @@ -0,0 +1,15 @@ +from django import template +from content.models import Category + +register = template.Library() + + +@register.tag('load_categories') +def load_site_settings(parser, token): + return LoadCategoriesNode() + + +class LoadCategoriesNode(template.Node): + def render(self, context): + context['categories'] = Category.objects.all() + return ''