[Django] #23595: “add” button for related fields in admin interface should send 'limit_choices_to' parameter to add form

37 views
Skip to first unread message

Django

unread,
Oct 3, 2014, 4:29:31 PM10/3/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+--------------------
Reporter: macarena | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 1
--------------------------------------+--------------------
I think it's self-explanatory. When the related field has a
'limit_choices_to' parameter, the new object added to the related class
should have that field pre-defined with the 'limit_choices_to' value.

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

Django

unread,
Oct 14, 2014, 9:50:51 AM10/14/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+------------------------------------
Reporter: macarena | Owner: gchp
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => gchp
* needs_docs: => 0
* stage: Unreviewed => Accepted


Comment:

Makes sense to me, and verified that this is indeed not happening already.

--
Ticket URL: <https://code.djangoproject.com/ticket/23595#comment:1>

Django

unread,
Oct 14, 2014, 11:13:28 AM10/14/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+------------------------------------
Reporter: macarena | Owner: gchp
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by charettes):

The correct way of doing this would be to convert `limit_choices_to` to
form level constraints and not to populate concerned fields.

i.e. how would you populate a field based on `limit_choices_to =
{'integer_field__gte': 3}`?

--
Ticket URL: <https://code.djangoproject.com/ticket/23595#comment:2>

Django

unread,
Oct 14, 2014, 11:18:40 AM10/14/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+------------------------------------
Reporter: macarena | Owner: gchp
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by gchp):

charettes, how would you convert `limit_choices_to` in the way you
mention?

--
Ticket URL: <https://code.djangoproject.com/ticket/23595#comment:3>

Django

unread,
Oct 14, 2014, 11:25:06 AM10/14/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+------------------------------------
Reporter: macarena | Owner: gchp
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by charettes):

@gchp, Django doesn't provide any helper to do such a thing which might be
the reason why this feature hasn't been implemented yet.

I was just pointing out that converting `limit_choices_to` to form initial
data is a naive approach since you're not enforcing anything and that it
has many limitations such as the one provided above.

--
Ticket URL: <https://code.djangoproject.com/ticket/23595#comment:4>

Django

unread,
Oct 14, 2014, 11:34:24 AM10/14/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+------------------------------------
Reporter: macarena | Owner: gchp
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
--------------------------------------+------------------------------------

Comment (by gchp):

@charettes, fair enough. I'll give it a go, anyways!

--
Ticket URL: <https://code.djangoproject.com/ticket/23595#comment:5>

Django

unread,
Dec 27, 2014, 7:14:46 PM12/27/14
to django-...@googlegroups.com
#23595: “add” button for related fields in admin interface should send
'limit_choices_to' parameter to add form
--------------------------------------+------------------------------------
Reporter: macarena | Owner: gchp
Type: Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* cc: cmawebsite@… (added)


Comment:

Maybe this will solve #29 :)

--
Ticket URL: <https://code.djangoproject.com/ticket/23595#comment:6>

Reply all
Reply to author
Forward
0 new messages