[Django] #21632: Docs: Unsupported example with a callable as a query parameter

5 views
Skip to first unread message

Django

unread,
Dec 18, 2013, 12:53:37 AM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+--------------------
Reporter: marfire | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Using callables as query parameters is an undocumented feature (#11629)
that doesn't seem to be working (#20241). As such, use of it was removed
from the tutorial (#20249).

However, this usage still exists in an
[https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to
example] accompanying the documentation for the `limit_choices_to`
argument to `ForeignKey`. Let's use a different example.

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

Django

unread,
Dec 18, 2013, 12:57:47 AM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+--------------------------------------
Reporter: marfire | Owner: marfire
Type: Bug | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => marfire
* needs_docs: => 0
* has_patch: 0 => 1


Comment:

Patch here: https://github.com/django/django/pull/2087.

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

Django

unread,
Dec 18, 2013, 6:53:34 AM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+------------------------------------

Reporter: marfire | Owner: marfire
Type: Bug | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

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

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Hi,

From my limited testing, using callable values in `limit_choices_to` is
only half-broken:

* It works when doing model validation (the callable is evaluated every
time you call `model.full_clean()`)
* Ir works in the admin if you let the admin generate a modelform for you
(the callable is evaluated for every request).
* It's broken for modelforms (the callable is evaluated only when the
`ModelForm` is declared, not when instanciated).


Consequently, I think it makes sense to remove it from the documentation,
at least while we sort out #11629 and #20241.

However, your patch makes it seem like `limit_choices_to` is only useful
in the admin but that's not the case: it's a property that affects the
generation of `ModelForms` (both its rendering and its validation) and
it's also used when doing model validation.


Thanks.

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

Django

unread,
Dec 18, 2013, 12:37:59 PM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+------------------------------------
Reporter: marfire | Owner: marfire
Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

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

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


Comment:

In [changeset:"d34c8c338a843df2a540f19d15efc1ff12e3119c"]:
{{{
#!CommitTicketReference repository=""
revision="d34c8c338a843df2a540f19d15efc1ff12e3119c"
Fixed #21632 -- Docs: Removed example with callable as query parameter

Using callables as query parameters is undocumented and not working,
so this changes an example from the ForeignKey.limit_choices_to
documentation that uses it.
}}}

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

Django

unread,
Dec 18, 2013, 12:38:20 PM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+------------------------------------
Reporter: marfire | Owner: marfire
Type: Bug | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

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

In [changeset:"dd7e2925dd63700a70f04a1e4c0df837acbdd55c"]:
{{{
#!CommitTicketReference repository=""
revision="dd7e2925dd63700a70f04a1e4c0df837acbdd55c"
[1.6.x] Fixed #21632 -- Docs: Removed example with callable as query
parameter

Using callables as query parameters is undocumented and not working,
so this changes an example from the ForeignKey.limit_choices_to
documentation that uses it.

Backport of d34c8c338a from master
}}}

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

Django

unread,
Dec 18, 2013, 12:38:22 PM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+------------------------------------
Reporter: marfire | Owner: marfire
Type: Bug | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

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

In [changeset:"6833773775fe135c38768418d31ec3f789d8f06f"]:
{{{
#!CommitTicketReference repository=""
revision="6833773775fe135c38768418d31ec3f789d8f06f"
[1.5.x] Fixed #21632 -- Docs: Removed example with callable as query
parameter

Using callables as query parameters is undocumented and not working,
so this changes an example from the ForeignKey.limit_choices_to
documentation that uses it.

Backport of d34c8c338a from master
}}}

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

Django

unread,
Dec 18, 2013, 12:40:32 PM12/18/13
to django-...@googlegroups.com
#21632: Docs: Unsupported example with a callable as a query parameter
-------------------------------+------------------------------------
Reporter: marfire | Owner: marfire
Type: Bug | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by timo):

For the record, bmispelon and I chatted about his comment above. He said
he may have read the patch too quickly and missed that the note does
mention ModelForm.

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

Reply all
Reply to author
Forward
0 new messages