Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>UPDATE:</strong> Since Django 1.8, this is built in.</p> <p>See <a href="https://stackoverflow.com/a/28170958/493272">this answer</a> and <a href="https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.show_change_link" rel="nofollow noreferrer">the official documentation</a>.</p> <p><strong>OLD ANSWER:</strong></p> <p>At the end I found a simple solution.</p> <p>I create a new template called <code>linked.html</code> that is a copy of <code>tabular.html</code> and I added this code to create the link.</p> <pre><code>{% if inline_admin_form.original.pk %} &lt;td class="{{ field.field.name }}"&gt; &lt;a href="/admin/{{ app_label }}/{{ inline_admin_formset.opts.admin_model_path }}/{{ inline_admin_form.original.pk }}/"&gt;Full record&lt;/a&gt; &lt;/td&gt; {% endif %} </code></pre> <p>then I created a new model <code>LinkedInline</code> inheriting <code>InlineModelAdmin</code></p> <pre><code>#override of the InlineModelAdmin to support the link in the tabular inline class LinkedInline(admin.options.InlineModelAdmin): template = "admin/linked.html" admin_model_path = None def __init__(self, *args): super(LinkedInline, self).__init__(*args) if self.admin_model_path is None: self.admin_model_path = self.model.__name__.lower() </code></pre> <p>Then when I define a new inline, I have only to use my <code>LinkedInline</code> instead of the normal <code>InlineModelAdmin</code>.</p> <p>I hope it can be useful for other people.</p> <p>Giovanni</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload