From 038cfc35fb5c253c0d7f8b535277c9a1b006fe49 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 5 Aug 2011 12:44:06 -0400 Subject: [PATCH] Translate edit-inline template patch to Grappelli's template. Also move it back to example/data/templates/, because otherwise it won't override the built-in template. --- .../templates/admin/edit_inline/tabular.html | 129 ------------- .../templates/admin/edit_inline/tabular.html | 181 ++++++++++++++++++ example/settings.py | 1 + 3 files changed, 182 insertions(+), 129 deletions(-) delete mode 100644 cookbook/templates/admin/edit_inline/tabular.html create mode 100644 example/data/templates/admin/edit_inline/tabular.html diff --git a/cookbook/templates/admin/edit_inline/tabular.html b/cookbook/templates/admin/edit_inline/tabular.html deleted file mode 100644 index b0a2c65..0000000 --- a/cookbook/templates/admin/edit_inline/tabular.html +++ /dev/null @@ -1,129 +0,0 @@ -{% load i18n adminmedia admin_modify %} -{% load url from future %} -
- -
- - diff --git a/example/data/templates/admin/edit_inline/tabular.html b/example/data/templates/admin/edit_inline/tabular.html new file mode 100644 index 0000000..f7f1146 --- /dev/null +++ b/example/data/templates/admin/edit_inline/tabular.html @@ -0,0 +1,181 @@ +{% load i18n adminmedia grp_tags %} +{% load url from future %} + +
+

{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}

+ + {{ inline_admin_formset.formset.management_form }} + {{ inline_admin_formset.formset.non_form_errors }} + +
+
+
+ {% for field in inline_admin_formset.fields %} + {% if not field.widget.is_hidden %} +
{{ field.label|capfirst }}
+ {% endif %} + {% endfor %} + {% if inline_admin_formset.formset.can_delete %}
 
{% endif %} +
+
+ {% with inline_admin_formset.opts.sortable_field_name|default:"" as sortable_field_name %} + {% for inline_admin_form in inline_admin_formset|formsetsort:sortable_field_name %} + +
+ {% if inline_admin_form.form.non_field_errors %} +
  • {{ inline_admin_form.form.non_field_errors }}
+ {% endif %} +

{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}  {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}

+ {% spaceless %} + {% for fieldset in inline_admin_form %} + {% for line in fieldset %} + {% for field in line %} + {% if field.is_hidden %} {{ field.field }} {% endif %} + {% endfor %} + {% endfor %} + {% endfor %} + {% endspaceless %} +
+ {% for fieldset in inline_admin_form %} + {% for line in fieldset %} + {% for field in line %} +
+ {% if field.is_readonly %} +

{{ field.contents }}

+ {% else %} + {{ field.field }} + {{ field.field.errors.as_ul }} + {% endif %} + {% if field.field.help_text %}

{{ field.field.help_text }}

{% endif %} +
+ {% endfor %} + {% endfor %} + {% endfor %} +
+ {% spaceless %} +
    + {% if inline_admin_form.model_admin.show_edit_link and inline_admin_form.original %}
  • Edit
  • {% endif %} + {% if inline_admin_form.show_url %}{% endif %} + {% if inline_admin_formset.opts.sortable_field_name %} +
  • + {% endif %} + {% if inline_admin_formset.formset.can_delete %} +
  • {{ inline_admin_form.deletion_field.field }}
  • + {% else %} + {% if inline_admin_form.original %} +
  •  
  • + {% else %} +
  • + {% endif %} + {% endif %} +
+ {% endspaceless %} +
+ {{ inline_admin_form.fk_field.field }} + {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %} +
+
+ {% endfor %} + {% endwith %} +
+ +
+ + diff --git a/example/settings.py b/example/settings.py index 49d2f64..ffefb6d 100644 --- a/example/settings.py +++ b/example/settings.py @@ -120,6 +120,7 @@ TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. + os.path.join(DATA_DIRECTORY, 'templates'), ) INSTALLED_APPS = ( -- 2.26.2