site_tps/content/templatetags/categories.py
2018-01-20 23:10:10 +01:00

15 lines
348 B
Python

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