From d34c8c338a843df2a540f19d15efc1ff12e3119c Mon Sep 17 00:00:00 2001 From: Kevin Christopher Henry Date: Wed, 18 Dec 2013 00:40:25 -0500 Subject: [PATCH] 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. --- docs/ref/models/fields.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 20e0975c18b..cc2a4cdcf4e 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1068,14 +1068,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 ` + 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:`Q object ` for more :ref:`complex queries