Ticket #6779: inline_delete_only_existing.diff

File inline_delete_only_existing.diff, 2.6 KB (added by Chris Beaven, 17 years ago)
  • django/contrib/admin/templates/admin/edit_inline/stacked.html

     
    66{% for inline_admin_form in inline_admin_formset %}
    77<div class="inline-related {% if forloop.last %}last-related{% endif %}">
    88  <h2><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %}
    9     {% if inline_admin_formset.formset.deletable %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
     9    {% if inline_admin_formset.formset.deletable and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
    1010    </h2>
    1111  {% if inline_admin_form.show_url %}
    1212  <p><a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p>
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

     
    1313     {% endfor %}
    1414     {% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %}
    1515     </tr></thead>
    16    
     16
    1717     {% for inline_admin_form in inline_admin_formset %}
    18                    
     18
    1919        <tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
    2020
    2121        <td class="original">{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
     
    4444            {% endfor %}
    4545          {% endfor %}
    4646        {% endfor %}
    47                
    48         {% if inline_admin_formset.formset.deletable %}<td class="delete">{{ inline_admin_form.deletion_field.field }}</td>{% endif %}
    49        
     47
     48        {% if inline_admin_formset.formset.deletable %}<td class="delete">{% if inline_admin_form.original %}{{ inline_admin_form.deletion_field.field }}{% endif %}</td>{% endif %}
     49
    5050        </tr>
    5151
    5252     {% endfor %}
    53    
     53
    5454   </table>
    55    
     55
    5656</fieldset>
    5757  </div>
    58  
     58
    5959  {# <ul class="tools"> #}
    6060  {#   <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #}
    6161  {# </ul> #}
    62  
     62
    6363</div>
Back to Top