From f0fb78f5c7fa603d906555c8f813fa9ddbd03e08 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 10 Nov 2010 04:12:07 +0100 Subject: [PATCH] Updated template to fit original admin style and added helper variable to check if value differs from its default. --- constance/admin.py | 1 + .../admin/constance/change_list.html | 62 ++++++++----------- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/constance/admin.py b/constance/admin.py index 12618f8..f3694fb 100644 --- a/constance/admin.py +++ b/constance/admin.py @@ -89,6 +89,7 @@ class ConstanceAdmin(admin.ModelAdmin): 'default': localize(default), 'help_text': help_text, 'value': localize(value), + 'modified': value != default, 'form_field': form[name] }) context['config'].sort(key=itemgetter('name')) diff --git a/constance/templates/admin/constance/change_list.html b/constance/templates/admin/constance/change_list.html index 13b5aef..f975374 100644 --- a/constance/templates/admin/constance/change_list.html +++ b/constance/templates/admin/constance/change_list.html @@ -1,5 +1,4 @@ {% extends "admin/base_site.html" %} -{% load i18n %} {% load adminmedia admin_list i18n %} @@ -10,23 +9,14 @@ {{ media.css }} {% endblock %} @@ -35,42 +25,44 @@ {{ block.super }} {{ media.js }} - {% endblock %} +{% block bodyclass %}change-list{% endblock %} {% block content %}
{% csrf_token %} - - - - - - +
NameDefaultValueHelp text
+ + + + + + + {% for item in config %} - - - + + + - + {% endfor %}
{% trans "Name" %}{% trans "Default" %}{% trans "Value" %}{% trans "Is modified" %}
{{item.name}}{{item.default}}
{{item.name}} +
{{item.help_text}}
+
+ {{ item.default }} + {{item.form_field.errors}} {{item.form_field}} {{item.help_text}} + %s +
-
- -
+

+ +