Chargement des catégories par templatetag.

This commit is contained in:
Klafyvel 2018-01-20 23:09:55 +01:00
parent afb8d3c0ec
commit 1b830b87fb
2 changed files with 15 additions and 0 deletions

View file

View file

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