Siobhan Tully | 30fd429 | 2013-05-10 08:59:56 -0400 | [diff] [blame^] | 1 | {% load i18n admin_static admin_modify %} |
| 2 | <div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group"> |
| 3 | <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}"> |
| 4 | {{ inline_admin_formset.formset.management_form }} |
| 5 | <fieldset class="module"> |
| 6 | <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2> |
| 7 | {{ inline_admin_formset.formset.non_form_errors }} |
| 8 | <table> |
| 9 | <thead><tr> |
| 10 | {% for field in inline_admin_formset.fields %} |
| 11 | {% if not field.widget.is_hidden %} |
| 12 | <th{% if forloop.first %} colspan="2"{% endif %}{% if field.required %} class="required"{% endif %}>{{ field.label|capfirst }} |
| 13 | {% if field.help_text %} <img src="{% static "admin/img/icon-unknown.gif" %}" class="help help-tooltip" width="10" height="10" alt="({{ field.help_text|striptags }})" title="{{ field.help_text|striptags }}" />{% endif %} |
| 14 | </th> |
| 15 | {% endif %} |
| 16 | {% endfor %} |
| 17 | {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %} |
| 18 | </tr></thead> |
| 19 | |
| 20 | <tbody> |
| 21 | {% for inline_admin_form in inline_admin_formset %} |
| 22 | {% if inline_admin_form.form.non_field_errors %} |
| 23 | <tr><td colspan="{{ inline_admin_form|cell_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr> |
| 24 | {% endif %} |
| 25 | <tr class="form-row {% cycle "row1" "row2" %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}{% if forloop.last %} empty-form{% endif %}" |
| 26 | id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}"> |
| 27 | <td class="original"> |
| 28 | {% if inline_admin_form.original or inline_admin_form.show_url %}<p> |
| 29 | {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %} |
| 30 | {% if inline_admin_form.show_url %}<a href="{% url 'admin:view_on_site' inline_admin_form.original_content_type_id inline_admin_form.original.pk %}">{% trans "View on site" %}</a>{% endif %} |
| 31 | </p>{% endif %} |
| 32 | {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %} |
| 33 | {{ inline_admin_form.fk_field.field }} |
| 34 | {% spaceless %} |
| 35 | {% for fieldset in inline_admin_form %} |
| 36 | {% for line in fieldset %} |
| 37 | {% for field in line %} |
| 38 | {% if field.is_hidden %} {{ field.field }} {% endif %} |
| 39 | {% endfor %} |
| 40 | {% endfor %} |
| 41 | {% endfor %} |
| 42 | {% endspaceless %} |
| 43 | </td> |
| 44 | {% for fieldset in inline_admin_form %} |
| 45 | {% for line in fieldset %} |
| 46 | {% for field in line %} |
| 47 | <td{% if field.field.name %} class="field-{{ field.field.name }}"{% endif %}> |
| 48 | {% if field.is_readonly %} |
| 49 | <p>{{ field.contents|linebreaksbr }}</p> |
| 50 | {% else %} |
| 51 | {{ field.field.errors.as_ul }} |
| 52 | {{ field.field }} |
| 53 | {% endif %} |
| 54 | </td> |
| 55 | {% endfor %} |
| 56 | {% endfor %} |
| 57 | {% endfor %} |
| 58 | {% if inline_admin_formset.formset.can_delete %} |
| 59 | <td class="delete">{% if inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }}{% endif %}</td> |
| 60 | {% endif %} |
| 61 | </tr> |
| 62 | {% endfor %} |
| 63 | </tbody> |
| 64 | </table> |
| 65 | </fieldset> |
| 66 | </div> |
| 67 | </div> |
| 68 | |
| 69 | <script type="text/javascript"> |
| 70 | |
| 71 | (function($) { |
| 72 | $("#{{ inline_admin_formset.formset.prefix }}-group .tabular.inline-related tbody tr").tabularFormset({ |
| 73 | prefix: "{{ inline_admin_formset.formset.prefix }}", |
| 74 | adminStaticPrefix: '{% static "admin/" %}', |
| 75 | addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}", |
| 76 | deleteText: "{% trans 'Remove' %}" |
| 77 | }); |
| 78 | })(django.jQuery); |
| 79 | </script> |