From 1b830b87fb45f077d12723c93e605d6d54b9ffb1 Mon Sep 17 00:00:00 2001 From: Klafyvel Date: Sat, 20 Jan 2018 23:09:55 +0100 Subject: [PATCH] =?UTF-8?q?Chargement=20des=20cat=C3=A9gories=20par=20temp?= =?UTF-8?q?latetag.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/templatetags/__init__.py | 0 content/templatetags/categories.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 content/templatetags/__init__.py create mode 100644 content/templatetags/categories.py 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 ''