[Django] #13163: Display link to change-form on inlines where model is registered in admin site

58 views
Skip to first unread message

Django

unread,
Mar 19, 2010, 8:13:32 PM3/19/10
to djang...@holovaty.com, django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
----------------------------------+-----------------------------------------
Reporter: DrMeers | Owner: nobody
Status: new | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Keywords: inline link | Stage: Unreviewed
Has_patch: 1 |
----------------------------------+-----------------------------------------
If an inline object has a {{{get_absolute_url}}} method, a 'View on site'
link is displayed.

Here I propose that if an inline object is registered in the same admin
site, an 'Edit' link is displayed in a similar fashion.

Why?

* The inline may only display a subset of fields, so the user may wish to
go to the full change form
* 'Recursive inlines' can be accessed more easily -- e.g. {{{Household}}}
has {{{Person}}} inlines, and {{{Person}}} has {{{Phone}}} inlines, etc.

The attached patch shows a draft implementation.

Questions:

* Do we need to check if the user has change permissions on that model
before displaying the link? (in the unlikely event that the user has
permission to change a model which displays the inlines of a model which
they do not have change permissions for). Given that I cannot see a
straightforward way of checking for this without the addition of a
template tag/filter, and the rarity of such setups, I'd be happy to let
the user click the link and get a permission denied page.
* Do we need an {{{InlineModelAdmin}}} option for enabling/disabling this
link? E.g. {{{InlineModelAdmin.show_admin_link}}}. Or are we happy to have
it enabled globally?
* Is {{{[ Edit ]}}} a sufficiently understandable link label? Would "Edit
in Admin", or "Display full form" or something be more appropriate?

I think the reciprocal of this would also be very useful --
{{{ForeignKey}}} widgets could display an {{{[edit]}}} link beside the
"add new" (green +) link which links to the change form for the selected
parent object.

--
Ticket URL: <http://code.djangoproject.com/ticket/13163>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 19, 2010, 9:39:03 PM3/19/10
to djang...@holovaty.com, django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------------------+--------------------------------
Reporter: DrMeers | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords: inline link
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by kmtracey):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* milestone: 1.2 =>

Comment:

This is a feature request and thus not appropriate for the 1.2 milestone
at this point.

--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:1>

Django

unread,
Mar 19, 2010, 11:37:50 PM3/19/10
to djang...@holovaty.com, django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
--------------------------------------+-------------------------------------
Reporter: DrMeers | Owner: DrMeers
Status: assigned | Milestone:
Component: User Experience | Version: SVN
Resolution: | Keywords: inline link
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by DrMeers):

* owner: => DrMeers
* status: new => assigned

--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:3>

Django

unread,
May 19, 2010, 9:54:33 PM5/19/10
to djang...@holovaty.com, django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
--------------------------------------+-------------------------------------
Reporter: DrMeers | Owner: DrMeers
Status: assigned | Milestone: 1.3
Component: User Experience | Version: SVN
Resolution: | Keywords: inline link
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by DrMeers):

* milestone: => 1.3

--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-update...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.

Django

unread,
Dec 20, 2010, 5:31:57 AM12/20/10
to djang...@holovaty.com, django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
--------------------------------------+-------------------------------------
Reporter: DrMeers | Owner: DrMeers
Status: assigned | Milestone: 1.3
Component: User Experience | Version: SVN
Resolution: | Keywords: inline link
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by anonymous):

* cc: sr...@mahiti.org (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:5>

Django

unread,
Mar 27, 2011, 5:25:20 PM3/27/11
to djang...@holovaty.com, django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------------------+---------------------------
Reporter: DrMeers | Owner: DrMeers
Status: assigned | Milestone: 1.3
Component: User Experience | Version: SVN
Resolution: | Keywords: inline link
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 |
-------------------------------------------+---------------------------
Changes (by EnTeQuAk):

* cc: cg@… (added)


--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:6>

Django

unread,
Apr 28, 2011, 9:26:26 AM4/28/11
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
---------------------------------------+---------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Milestone: 1.3 | Component: User Experience
Version: SVN | Severity: Normal
Resolution: | Keywords: inline link
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
---------------------------------------+---------------------------------
Changes (by anonymous):

* easy: => 0


Comment:

With Django 1.3 does not work. Is there anything like that under 1.3 ?

--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:9>

Django

unread,
May 5, 2011, 2:47:11 PM5/5/11
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
---------------------------------------+---------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Milestone: 1.3 | Component: User Experience
Version: SVN | Severity: Normal
Resolution: | Keywords: inline link
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
---------------------------------------+---------------------------------
Changes (by patchhammer):

* needs_better_patch: 0 => 1


Comment:

combined_13165_13165.diff fails to apply cleanly on to trunk

--
Ticket URL: <http://code.djangoproject.com/ticket/13163#comment:10>
Django <https://code.djangoproject.com/>

Django

unread,
Jun 9, 2011, 12:38:36 PM6/9/11
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
---------------------------------------+-------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Milestone: 1.3 | Component: contrib.admin
Version: SVN | Severity: Normal
Resolution: | Keywords: inline link
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 1
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 1 |
---------------------------------------+-------------------------------
Changes (by dperetti):

* needs_tests: 0 => 1


Comment:

Hey guys, I've just added above my own implementation of this feature.
Very simple, just 3 lines of code but does the job.
(This patch does it only in tabular.html).


{{{
class BooksInline(admin.TabularInline):
model = Book
show_edit_link = True
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:13>

Django

unread,
Jan 23, 2012, 9:10:38 AM1/23/12
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by anonymous):

any chance this will make it into 1.4 ?

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:15>

Django

unread,
Mar 3, 2012, 1:06:33 AM3/3/12
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by anonymous):

still waiting for this to become a feature.

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:16>

Django

unread,
Mar 17, 2012, 10:47:18 AM3/17/12
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: SVN
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by glicerinu@…):

* cc: glicerinu@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:17>

Django

unread,
May 10, 2012, 4:31:06 PM5/10/12
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by charettes):

I packaged a simple app providing admin mixins to add a the edition and
deletion links on all amin FK widgets, including those in inlines. You can
find the project on [https://github.com/charettes/django-admin-enhancer
github] and on [http://pypi.python.org/pypi/django-admin-enhancer/0.1.0
pypi].

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:18>

Django

unread,
Jun 19, 2014, 9:05:21 PM6/19/14
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by blueyed):

@smcoll:

It looks like there is a wrong `if` in your patch: `{% if
inline_admin_form.original %}`. It should check for the new
`show_edit_link` option probably.

I assume that it won't work for many2many inlines, where you have `model =
Foo.bars.through`?

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:19>

Django

unread,
Jul 25, 2014, 10:51:33 AM7/25/14
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by slurms):

* needs_docs: 0 => 1
* needs_tests: 1 => 0
* needs_better_patch: 1 => 0


Comment:

PR here: https://github.com/django/django/pull/2957.

I added a method `AdminSite.is_registered()` which takes a `Model` class
or lowercased model name. This is needed for checking if the
`InlineModelAdmin`'s model is also registered as a `ModelAdmin` on the
site. There is precedence for this sort of check with registries -- the
app registry has `apps.is_installed()`, and it seems to be a reasonable
method to have on the `AdminSite`.

Renamed the `show_edit_link` to `show_change_link` for consistency across
the admin. The link will only be displayed if `show_change_link = True` on
the inline, the model itself is also registered, and there is an inline
object to change.

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:20>

Django

unread,
Jul 25, 2014, 11:43:56 AM7/25/14
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by slurms):

* needs_docs: 1 => 0


Comment:

Added docs, updated PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:21>

Django

unread,
Jul 31, 2014, 8:10:14 AM7/31/14
to django-...@googlegroups.com
#13163: Display link to change-form on inlines where model is registered in admin
site
-------------------------------+------------------------------------
Reporter: DrMeers | Owner: DrMeers
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: inline link | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"9d9f0acd7e245c9f9c30727a003666618754c924"]:
{{{
#!CommitTicketReference repository=""
revision="9d9f0acd7e245c9f9c30727a003666618754c924"
Fixed #13163 -- Added ability to show change links on inline objects in
admin.

Thanks DrMeers for the suggestion.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/13163#comment:22>

Reply all
Reply to author
Forward
0 new messages