Templatetag pour charger les options du site
This commit is contained in:
parent
32a7493bb7
commit
5dfa004a4f
2 changed files with 15 additions and 0 deletions
0
settings/templatetags/__init__.py
Normal file
0
settings/templatetags/__init__.py
Normal file
15
settings/templatetags/load_settings.py
Normal file
15
settings/templatetags/load_settings.py
Normal file
|
@ -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 ''
|
Loading…
Reference in a new issue