From 4c865bcc4e6525d1ec6d1f343d4bebae9a8992eb Mon Sep 17 00:00:00 2001 From: Kenneth Love Date: Mon, 16 Jan 2012 13:42:23 -0800 Subject: [PATCH] default django admin templates to use as a base --- djrill/templates/djrill/change_form.html | 71 ++++++++++++ djrill/templates/djrill/change_list.html | 104 ++++++++++++++++++ .../templates/djrill/change_list_results.html | 27 +++++ djrill/templates/djrill/filter.html | 8 ++ djrill/templates/djrill/pagination.html | 12 ++ 5 files changed, 222 insertions(+) create mode 100644 djrill/templates/djrill/change_form.html create mode 100644 djrill/templates/djrill/change_list.html create mode 100644 djrill/templates/djrill/change_list_results.html create mode 100644 djrill/templates/djrill/filter.html create mode 100644 djrill/templates/djrill/pagination.html diff --git a/djrill/templates/djrill/change_form.html b/djrill/templates/djrill/change_form.html new file mode 100644 index 0000000..fb278b4 --- /dev/null +++ b/djrill/templates/djrill/change_form.html @@ -0,0 +1,71 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_modify adminmedia %} +{% load url from future %} + +{% block extrahead %}{{ block.super }} +{% url 'admin:jsi18n' as jsi18nurl %} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %} + +{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} + +{% block breadcrumbs %}{% if not is_popup %} + +{% endif %}{% endblock %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if save_on_top %}{% submit_row %}{% endif %} +{% if errors %} +

+ {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} + +{% block after_field_sets %}{% endblock %} + +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} + +{% block after_related_objects %}{% endblock %} + +{% submit_row %} + +{% if adminform and add %} + +{% endif %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% endblock %} diff --git a/djrill/templates/djrill/change_list.html b/djrill/templates/djrill/change_list.html new file mode 100644 index 0000000..33b5201 --- /dev/null +++ b/djrill/templates/djrill/change_list.html @@ -0,0 +1,104 @@ +{% extends "admin/base_site.html" %} +{% load adminmedia admin_list i18n %} +{% load url from future %} +{% block extrastyle %} + {{ block.super }} + + {% if cl.formset %} + + {% endif %} + {% if cl.formset or action_form %} + {% url 'admin:jsi18n' as jsi18nurl %} + + {% endif %} + {{ media.css }} + {% if not actions_on_top and not actions_on_bottom %} + + {% endif %} +{% endblock %} + +{% block extrahead %} +{{ block.super }} +{{ media.js }} +{% if action_form %}{% if actions_on_top or actions_on_bottom %} + +{% endif %}{% endif %} +{% endblock %} + +{% block bodyclass %}change-list{% endblock %} + +{% if not is_popup %} + {% block breadcrumbs %} + + {% endblock %} +{% endif %} + +{% block coltype %}flex{% endblock %} + +{% block content %} +
+ {% block object-tools %} + {% if has_add_permission %} + + {% endif %} + {% endblock %} + {% if cl.formset.errors %} +

+ {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} +

+ {{ cl.formset.non_form_errors }} + {% endif %} +
+ {% block search %}{% search_form cl %}{% endblock %} + {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %} + + {% block filters %} + {% if cl.has_filters %} +
+

{% trans 'Filter' %}

+ {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %} +
+ {% endif %} + {% endblock %} + +
{% csrf_token %} + {% if cl.formset %} +
{{ cl.formset.management_form }}
+ {% endif %} + + {% block result_list %} + {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %} + {% result_list cl %} + {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %} + {% endblock %} + {% block pagination %}{% pagination cl %}{% endblock %} +
+
+
+{% endblock %} diff --git a/djrill/templates/djrill/change_list_results.html b/djrill/templates/djrill/change_list_results.html new file mode 100644 index 0000000..891268f --- /dev/null +++ b/djrill/templates/djrill/change_list_results.html @@ -0,0 +1,27 @@ +{% if result_hidden_fields %} +
{# DIV for HTML validation #} +{% for item in result_hidden_fields %}{{ item }}{% endfor %} +
+{% endif %} +{% if results %} +
+ + + +{% for header in result_headers %}{% endfor %} + + + +{% for result in results %} +{% if result.form.non_field_errors %} + +{% endif %} +{% for item in result %}{{ item }}{% endfor %} +{% endfor %} + +
+{% if header.sortable %}{% endif %} +{{ header.text|capfirst }} +{% if header.sortable %}{% endif %}
{{ result.form.non_field_errors }}
+
+{% endif %} diff --git a/djrill/templates/djrill/filter.html b/djrill/templates/djrill/filter.html new file mode 100644 index 0000000..9ef69ff --- /dev/null +++ b/djrill/templates/djrill/filter.html @@ -0,0 +1,8 @@ +{% load i18n %} +

{% blocktrans with title as filter_title %} By {{ filter_title }} {% endblocktrans %}

+ diff --git a/djrill/templates/djrill/pagination.html b/djrill/templates/djrill/pagination.html new file mode 100644 index 0000000..3588132 --- /dev/null +++ b/djrill/templates/djrill/pagination.html @@ -0,0 +1,12 @@ +{% load admin_list %} +{% load i18n %} +

+{% if pagination_required %} +{% for i in page_range %} + {% paginator_number cl i %} +{% endfor %} +{% endif %} +{{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %} +{% if show_all_url %}  {% trans 'Show all' %}{% endif %} +{% if cl.formset and cl.result_count %}{% endif %} +