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 ''