From 5dfa004a4fa20a24529faad214f88d7eeed62dcc Mon Sep 17 00:00:00 2001 From: Klafyvel Date: Sat, 20 Jan 2018 23:13:30 +0100 Subject: [PATCH] Templatetag pour charger les options du site --- settings/templatetags/__init__.py | 0 settings/templatetags/load_settings.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 settings/templatetags/__init__.py create mode 100644 settings/templatetags/load_settings.py diff --git a/settings/templatetags/__init__.py b/settings/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/settings/templatetags/load_settings.py b/settings/templatetags/load_settings.py new file mode 100644 index 0000000..e45c9b1 --- /dev/null +++ b/settings/templatetags/load_settings.py @@ -0,0 +1,15 @@ +from django import template +from settings.models import SiteSettings + +register = template.Library() + + +@register.tag('load_site_settings') +def load_site_settings(parser, token): + return LoadSiteSettingsNode() + + +class LoadSiteSettingsNode(template.Node): + def render(self, context): + context['site_settings'] = SiteSettings.get_settings() + return ''