Ticket #13163: inline_edit_link.diff

File inline_edit_link.diff, 2.1 KB (added by Dominique PERETTI, 13 years ago)

Add show_edit_link = True to your ObjectInline and you get an edit link

  • django/contrib/admin/options.py

     
    13031303    verbose_name = None
    13041304    verbose_name_plural = None
    13051305    can_delete = True
     1306    show_edit_link = False
    13061307
    13071308    def __init__(self, parent_model, admin_site):
    13081309        self.admin_site = admin_site
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

     
    11{% load i18n adminmedia admin_modify %}
     2{% load url from future %}
    23<div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
    34  <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
    45{{ inline_admin_formset.formset.management_form }}
     
    2425             id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
    2526        <td class="original">
    2627          {% if inline_admin_form.original or inline_admin_form.show_url %}<p>
    27           {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}
     28          {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_edit_link and inline_admin_form.original %} <a href="{% url adminform.model_admin.admin_site.app_name|add:':'|add:app_label|add:'_'|add:inline_admin_formset.opts.opts.module_name|add:'_changelist' %}{{ inline_admin_form.original.pk }}">Edit</a>{% endif %}{% endif %}
    2829          {% 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 %}
    2930            </p>{% endif %}
    3031          {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
Back to Top