[Django] #20865: admin raw_id_fields does not call value in limit_choices_to

11 views
Skip to first unread message

Django

unread,
Aug 5, 2013, 11:09:07 PM8/5/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
--------------------------------+--------------------
Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------
The docs show that `limit_choices_to` works with callables:
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to

However, the raw_id_fields widget does not handle this correctly, and it
generates a url like so:
`/admin/auth/user/?last_login__lte=%3Cbuilt-
in%20method%20today%20of%20type%20object%20at%200xb72cd440%3E`

As far as I can tell, this has never worked correctly. I have a simple app
that demonstrates the problem:
https://github.com/collinanderson/limit_choices_to/commit/8e30de93dea1908ae363b8556e3f89d36b031e79

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

Django

unread,
Aug 5, 2013, 11:18:43 PM8/5/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
--------------------------------+--------------------------------------

Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* has_patch: 0 => 1
* version: master => 1.6-beta-1
* needs_tests: => 1
* needs_docs: => 0


Comment:

I realize that we're discussing a new api for limit_choices_to, but in the
meantime this should fix it:
https://github.com/django/django/pull/1442

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

Django

unread,
Aug 6, 2013, 11:28:51 AM8/6/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
--------------------------------+--------------------------------------

Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

* stage: Unreviewed => Accepted


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

Django

unread,
Aug 6, 2013, 12:40:41 PM8/6/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
--------------------------------+--------------------------------------

Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_tests: 1 => 0


Comment:

pull request now has a test https://github.com/django/django/pull/1442

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

Django

unread,
Aug 6, 2013, 1:17:05 PM8/6/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
-------------------------------------+-------------------------------------

Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version:
Severity: Normal | 1.6-beta-1
Keywords: | Resolution:
Has patch: 1 | Triage Stage: Ready for
Needs tests: 0 | checkin
Easy pickings: 0 | Needs documentation: 0
| Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by loic84):

* stage: Accepted => Ready for checkin


Comment:

Looks good to me.

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

Django

unread,
Aug 6, 2013, 1:42:55 PM8/6/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
-------------------------------------+-------------------------------------
Reporter: CollinAnderson | Owner: nobody
Type: Bug | Status: closed

Component: contrib.admin | Version:
Severity: Normal | 1.6-beta-1
Keywords: | Resolution: fixed

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

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


Comment:

In [changeset:"d53e574676ba0809394017f1f3a5bc24512e5bed"]:
{{{
#!CommitTicketReference repository=""
revision="d53e574676ba0809394017f1f3a5bc24512e5bed"
Fixed #20865 -- Fixed raw_id_fields to work with callable
limit_choices_to.
}}}

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

Django

unread,
Aug 6, 2013, 1:46:56 PM8/6/13
to django-...@googlegroups.com
#20865: admin raw_id_fields does not call value in limit_choices_to
-------------------------------------+-------------------------------------
Reporter: CollinAnderson | Owner: nobody

Type: Bug | Status: closed
Component: contrib.admin | Version:
Severity: Normal | 1.6-beta-1
Keywords: | Resolution: fixed
Has patch: 1 | Triage Stage: Ready for
Needs tests: 0 | checkin
Easy pickings: 0 | Needs documentation: 0
| Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"e3e0cf8a0f75ae18bc401182bfbdea2c27bb0244"]:
{{{
#!CommitTicketReference repository=""
revision="e3e0cf8a0f75ae18bc401182bfbdea2c27bb0244"
[1.6.x] Fixed #20865 -- Fixed raw_id_fields to work with callable
limit_choices_to.

Backport of d53e574676 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages