0001-searching-for-template-vars-dict-in-TEMPLATE_VARS-at.patch
passerelle/base/context_processors.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 |
from django.conf import settings |
|
4 |
from .models import TemplateVar |
|
5 | ||
3 | 6 |
def template_vars(request): |
4 | 7 |
""" |
5 | 8 |
returns a dict with all the template vars |
6 | 9 |
""" |
7 |
from .models import TemplateVar |
|
8 | ||
9 |
return dict((obj.name, obj.value) for obj in TemplateVar.objects.all()) |
|
10 |
vars = {} |
|
11 |
try: |
|
12 |
vars.update(settings.TEMPLATE_VARS) |
|
13 |
except AttributeError: |
|
14 |
pass |
|
15 |
finally: |
|
16 |
vars.update(dict((obj.name, obj.value) for obj in TemplateVar.objects.all())) |
|
17 |
return vars |
|
10 |
- |