Ticket #14810: stacked_example.diff

File stacked_example.diff, 4.2 KB (added by DrMeers, 5 years ago)

Example stacked template with a few blocks (and indentation...?)

  • django/contrib/admin/templates/admin/edit_inline/stacked.html

    diff -r 0675b0559260 django/contrib/admin/templates/admin/edit_inline/stacked.html
    a b  
    11{% load i18n adminmedia %}
    2 <div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
    3   <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
    4 {{ inline_admin_formset.formset.management_form }}
    5 {{ inline_admin_formset.formset.non_form_errors }}
     2{% block inline-group %}
     3  <div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
     4    {% block inline-group-title %}
     5      <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
     6    {% endblock %}
     7    {% block inline-group-top %}
     8      {{ inline_admin_formset.formset.management_form }}
     9      {{ inline_admin_formset.formset.non_form_errors }}
     10    {% endblock %}
     11    {% block inline-group-main %}
     12      {% for inline_admin_form in inline_admin_formset %}
     13        <div class="inline-related{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
     14          {% block inline-heading %}
     15            <h3>
     16              <b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;
     17              <span class="inline_label">
     18                {% if inline_admin_form.original %}
     19                  {{ inline_admin_form.original }}
     20                {% else %}
     21                  #{{ forloop.counter }}
     22                {% endif %}
     23              </span>
     24              {% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/">{% trans "View on site" %}</a>{% endif %}
     25              {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
     26            </h3>
     27          {% endblock %}
     28          {% block inline-main %}
     29            {% if inline_admin_form.form.non_field_errors %}
     30              {{ inline_admin_form.form.non_field_errors }}
     31            {% endif %}
     32            {% for fieldset in inline_admin_form %}
     33              {% include "admin/includes/fieldset.html" %}
     34            {% endfor %}
     35            {% if inline_admin_form.has_auto_field %}
     36              {{ inline_admin_form.pk_field.field }}
     37            {% endif %}
     38            {{ inline_admin_form.fk_field.field }}
     39          {% endblock %}
     40        </div>
     41      {% endfor %}
     42    </div>
     43  {% endblock inline-group-main %}
     44{% endblock inline-group %}
    645
    7 {% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
    8   <h3><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;<span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %}#{{ forloop.counter }}{% endif %}</span>
    9     {% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/">{% trans "View on site" %}</a>{% endif %}
    10     {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
    11   </h3>
    12   {% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %}
    13   {% for fieldset in inline_admin_form %}
    14     {% include "admin/includes/fieldset.html" %}
    15   {% endfor %}
    16   {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
    17   {{ inline_admin_form.fk_field.field }}
    18 </div>{% endfor %}
    19 </div>
    20 
     46{% block inline-js %}
    2147<script type="text/javascript">
    2248(function($) {
    2349    $(document).ready(function() {
     
    80106    });
    81107})(django.jQuery);
    82108</script>
     109{% endblock inline-js %}
Back to Top