Re: [Django] #9071: Can't disable "add" popup links in the admin

45 views
Skip to first unread message

Django

unread,
May 5, 2011, 2:44:22 PM5/5/11
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
---------------------------------------+-------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Milestone: | Component: contrib.admin
Version: 1.0 | Severity: Normal
Resolution: | Keywords: pyconuk
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
* easy: => 0


Comment:

disable_add_r15922.diff fails to apply cleanly on to trunk

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

Django

unread,
May 5, 2011, 10:21:13 PM5/5/11
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
---------------------------------------+-------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Milestone: | Component: contrib.admin
Version: 1.0 | Severity: Normal
Resolution: | Keywords: pyconuk
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
---------------------------------------+-------------------------------
Changes (by burzak):

* needs_better_patch: 1 => 0


Comment:

The patch had a little conflic, I updated the patch to apply to trunk.

--
Ticket URL: <http://code.djangoproject.com/ticket/9071#comment:16>

Django

unread,
Jun 9, 2011, 5:17:06 AM6/9/11
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
---------------------------------------+-------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Milestone: | Component: contrib.admin
Version: 1.0 | Severity: Normal
Resolution: | Keywords: pyconuk
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
---------------------------------------+-------------------------------
Changes (by julien):

* ui_ux: => 1


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

Django

unread,
Jul 12, 2011, 8:59:08 PM7/12/11
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
---------------------------------------+-------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Milestone: | Component: contrib.admin
Version: 1.0 | Severity: Normal
Resolution: | Keywords: pyconuk
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
---------------------------------------+-------------------------------

Comment (by SmileyChris):

Note that it's actually possible to do this now. Since r13708, the related
admin widget has a `can_add_related` attribute.

Using the `ModelAdmin.get_form` hook, set this to `False` for the
field(s) you want to disable the plus for.

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

Django

unread,
Jan 28, 2012, 5:05:02 AM1/28/12
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution:
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by julien):

#17547 is a duplicate and has a patch.

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

Django

unread,
Mar 20, 2012, 6:49:51 AM3/20/12
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution:
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by atkinsonr@…):

At present this isn't possible in an InlineModelAdmin, however the patch
in #17547 looks good as it is to BaseModelAdmin.

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

Django

unread,
Oct 10, 2012, 7:00:48 AM10/10/12
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution:
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by ivan_virabyan):

* cc: ivan_virabyan (added)


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

Django

unread,
Oct 31, 2013, 6:03:48 AM10/31/13
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution:
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Changes (by jaylett):

* cc: james@… (added)


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

Django

unread,
Jun 13, 2014, 6:23:19 PM6/13/14
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution:
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


Comment:

Needs a patch that applies cleanly.

--
Ticket URL: <https://code.djangoproject.com/ticket/9071#comment:23>

Django

unread,
Aug 21, 2014, 4:57:06 AM8/21/14
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: assigned
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution:
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------

Comment (by rhunwicks):

For others that end up on this page as the result of a Google Search or
similar, as described on http://stackoverflow.com/questions/10377642/how-
to-use-can-add-related-in-django-admin, the full version of the "Using the
`ModelAdmin.get_form hook`" comment is:

{{{#!python
class ProductAdmin(ModelAdmin):

def get_form(self, request, obj=None, **kwargs):
"""
Don't allow adding new Product Categories
"""
form = super(ProductAdmin, self).get_form(request, obj, **kwargs)
form.base_fields['category'].widget.can_add_related = False
return form
}}}

Given the simplicity of this, do we still need this ticket?

--
Ticket URL: <https://code.djangoproject.com/ticket/9071#comment:24>

Django

unread,
Jun 17, 2015, 2:41:54 PM6/17/15
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+--------------------------------------
Reporter: jacob | Owner: burzak
Type: New feature | Status: closed
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution: worksforme

Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by claudep):

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


Comment:

Closing as per last comment and lack of activity.

--
Ticket URL: <https://code.djangoproject.com/ticket/9071#comment:25>

Django

unread,
Apr 7, 2017, 2:44:12 PM4/7/17
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+---------------------------------------
Reporter: Jacob | Owner: Dario Ocles

Type: New feature | Status: closed
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution: worksforme
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+---------------------------------------

Comment (by Ryan Castner):

I know this was closed due to inactivity and the ease of doing this, but I
feel like the solution, while working and simple is not obvious and
requires knowledge of the internals of how the admin works to figure out.

A documented setting to attach to model admin like disable_add_related =
('field_name', ...) seems like it would be a better solution.

The purpose of this is for non-technical admins who should have the
ability to add a user but would be confused by the ability to add new
users inline while modifying a page, likely if you are creating a new
model with a foreign key to 'user' for instance, you don't want to be
creating a new user at that time, so displaying the option can only serve
to confuse the user

--
Ticket URL: <https://code.djangoproject.com/ticket/9071#comment:26>

Django

unread,
Apr 7, 2017, 4:33:46 PM4/7/17
to django-...@googlegroups.com
#9071: Can't disable "add" popup links in the admin
-------------------------------+---------------------------------------
Reporter: Jacob | Owner: Dario Ocles
Type: New feature | Status: closed
Component: contrib.admin | Version: 1.0
Severity: Normal | Resolution: worksforme
Keywords: pyconuk | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+---------------------------------------

Comment (by Tim Graham):

Not every use case can have a `ModelAdmin` attribute. To keep complexity
under control, I think it's better to avoid adding one where an
alternative exists.

--
Ticket URL: <https://code.djangoproject.com/ticket/9071#comment:27>

Reply all
Reply to author
Forward
0 new messages