summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorKevin Christopher Henry <k@severian.com>2013-12-18 00:40:25 -0500
committerTim Graham <timograham@gmail.com>2013-12-18 12:37:56 -0500
commitdd7e2925dd63700a70f04a1e4c0df837acbdd55c (patch)
treee80d933c07807712090f09e9c066d22ca5243a4d /docs/ref
parent60517c9c09daffee678fd4337687185ce38ed35b (diff)
[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
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/fields.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 3d474869a3..ca6c364670 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1064,14 +1064,13 @@ define the details of how the relation works.
.. attribute:: ForeignKey.limit_choices_to
A dictionary of lookup arguments and values (see :doc:`/topics/db/queries`)
- that limit the available admin or ModelForm choices for this object. Use
- this with functions from the Python ``datetime`` module to limit choices of
- objects by date. For example::
+ that limit the available admin or :class:`ModelForm <django.forms.ModelForm>`
+ choices for this object. For example::
- limit_choices_to = {'pub_date__lte': datetime.date.today}
+ staff_member = models.ForeignKey(User, limit_choices_to={'is_staff': True})
- only allows the choice of related objects with a ``pub_date`` before the
- current date to be chosen.
+ causes the corresponding field on the ``ModelForm`` to list only ``Users``
+ that have ``is_staff=True``.
Instead of a dictionary this can also be a :class:`~django.db.models.Q`
object for more :ref:`complex queries <complex-lookups-with-q>`. However,