1 {% load i18n adminmedia %}
4 <div class="group tabular{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}"
5 id="{{ inline_admin_formset.formset.prefix }}-group" >
6 <h2 class="collapse-handler">{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
8 <li class="add-handler-container"><a href="javascript://" class="icon add-handler" title="{% trans 'Add Another' %}"> </a></li>
10 {{ inline_admin_formset.formset.management_form }}
11 {{ inline_admin_formset.formset.non_form_errors }}
13 <div class="module table">
14 <div class="module thead">
16 {% for field in inline_admin_formset.fields %}
17 {% if not field.widget.is_hidden %}
18 <div class="th {{ field.label|lower }}{% if field.required %} required{% endif %}">{{ field.label|capfirst }}</div>
21 <div class="th content_type">Content type</div>
22 <div class="th value">Value</div>
23 {% if inline_admin_formset.formset.can_delete %}<div class="th"> </div>{% endif %}
26 {% for inline_admin_form in inline_admin_formset %}
28 <div class="module tbody{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form{% endif %}"
29 id="{{ inline_admin_formset.formset.prefix }}{% if not forloop.last %}{{ forloop.counter0 }}{% else %}-empty{% endif %}">
30 {% if inline_admin_form.form.non_field_errors %}
31 <ul class="errorlist"><li>{{ inline_admin_form.form.non_field_errors }}</li></ul>
33 <h3 style="display: none;"><b>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</b> {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}</h3>
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 %}
44 {% for fieldset in inline_admin_form %}
45 {% for line in fieldset %}
46 {% for field in line %}
47 <div class="td {{ field.field.name }} {% if field.field.errors %} error{% endif %}">
48 {% if field.is_readonly %}
49 <p>{{ field.contents }}</p>
52 {{ field.field.errors.as_ul }}
58 {% with inline_admin_form.form.content_type as field %}<div class="td {{ field.name }}{% if field.errors %} error{% endif %}">{{ field }}{{ field.errors.as_ul }}</div>{% endwith %}
59 {% with inline_admin_form.form.value as field %}<div class="td {{ field.name }}{% if field.errors %} error{% endif %}">{{ field }}{{ field.errors.as_ul }}</div>{% endwith %}
60 <div class="td tools">
63 {% if inline_admin_form.show_url %}<li class="viewsite-link-container"><a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/" class="icon viewsite-link" title="{% trans 'View on Site' %}"> </a></li>{% endif %}
64 {% if inline_admin_formset.opts.sortable_field_name %}
65 <li class="drag-handler-container"><a href="javascript://" class="icon drag-handler" title="{% trans 'Move Item' %}"></a></li>
67 {% if inline_admin_formset.formset.can_delete %}<li class="delete-handler-container">{{ inline_admin_form.deletion_field.field }}<a href="javascript://" class="icon {% if inline_admin_form.original %}delete-handler{% else %}remove-handler{% endif %}" title="{% trans 'Remove' %}"> </a>{% endif %}
71 {{ inline_admin_form.fk_field.field }}
72 {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
77 <div class="module add-item">
78 <a href="javascript://" class="add-handler">{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}</a>
80 <li class="add-handler-container"><a href="javascript://" class="icon add-handler" title="{% trans 'Add Item' %}"> </a></li>
81 </ul><br clear="all" />
85 <script type="text/javascript">
87 $(document).ready(function($) {
89 $("#{{ inline_admin_formset.formset.prefix }}-group").grp_inline({
90 prefix: "{{ inline_admin_formset.formset.prefix }}",
91 onBeforeAdded: function(inline) {},
92 onAfterAdded: function(form) {
93 grappelli.reinitDateTimeFields(form);
94 grappelli.updateSelectFilter(form);
95 form.find("input.vForeignKeyRawIdAdminField").grp_related_fk({lookup_url:"{% url grp_related_lookup %}"});
96 form.find("input.vManyToManyRawIdAdminField").grp_related_m2m({lookup_url:"{% url grp_m2m_lookup %}"});
97 form.find("input[name*='object_id'][name$='id']").grp_related_generic({lookup_url:"{% url grp_related_lookup %}"});
101 {% if inline_admin_formset.opts.sortable_field_name %}
102 $("#{{ inline_admin_formset.formset.prefix }}-group > div.table").sortable({
103 handle: "a.drag-handler",
104 items: "div.dynamic-form",
107 forceHelperSize: true,
108 containment: '#{{ inline_admin_formset.formset.prefix }}-group > div.table',
109 tolerance: 'pointer',
111 $("#{{ opts.module_name }}_form").bind("submit", function(){
112 var sortable_field_name = "{{ inline_admin_formset.opts.sortable_field_name }}";
114 $("#{{ inline_admin_formset.formset.prefix }}-group").find("div.dynamic-form").each(function(){
115 var fields = $(this).find("div.td :input[value]");
116 if (fields.serialize()) {
117 $(this).find("input[name$='"+sortable_field_name+"']").val(i);