mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Fix #115 - stop shadowing the context processor's config variable when rendering the admin change list.
This commit is contained in:
parent
a005625f97
commit
c82d76fc28
3 changed files with 17 additions and 4 deletions
|
|
@ -121,7 +121,7 @@ class ConstanceAdmin(admin.ModelAdmin):
|
|||
)
|
||||
return HttpResponseRedirect('.')
|
||||
context = {
|
||||
'config': [],
|
||||
'config_values': [],
|
||||
'title': _('Constance config'),
|
||||
'app_label': 'constance',
|
||||
'opts': Config._meta,
|
||||
|
|
@ -134,7 +134,7 @@ class ConstanceAdmin(admin.ModelAdmin):
|
|||
# Then if the returned value is None, get the default
|
||||
if value is None:
|
||||
value = getattr(config, name)
|
||||
context['config'].append({
|
||||
context['config_values'].append({
|
||||
'name': name,
|
||||
'default': localize(default),
|
||||
'help_text': _(help_text),
|
||||
|
|
@ -142,7 +142,7 @@ class ConstanceAdmin(admin.ModelAdmin):
|
|||
'modified': value != default,
|
||||
'form_field': form[name],
|
||||
})
|
||||
context['config'].sort(key=itemgetter('name'))
|
||||
context['config_values'].sort(key=itemgetter('name'))
|
||||
request.current_app = self.admin_site.name
|
||||
# compatibility to be removed when 1.7 is deprecated
|
||||
extra = {'current_app': self.admin_site.name} if VERSION < (1, 8) else {}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<th><div class="text">{% trans "Is modified" %}</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for item in config %}
|
||||
{% for item in config_values %}
|
||||
<tr class="{% cycle 'row1' 'row2' %}">
|
||||
<th>{{ item.name }}
|
||||
<div class="help">{{ item.help_text|linebreaksbr }}</div>
|
||||
|
|
|
|||
|
|
@ -83,7 +83,20 @@ TEMPLATES = [
|
|||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'constance.context_processors.config',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.core.context_processors.debug',
|
||||
'django.core.context_processors.i18n',
|
||||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.core.context_processors.tz',
|
||||
'django.core.context_processors.request',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'constance.context_processors.config',
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue