Fixed #12024: Changed admin code to avoid raising an exception when a field listed

in raw_id_fields has limit_choices_to specified as a Q object. 

Tweaked a test to trigger the condition and verify the fix. 

Finally, documented that limit_choices_to specified as a Q object has no effect 
on the choices available for fields listed in raw_id_fields, and removed another 
incorrect note that claimed limit_choices_to had no effect on inlines in the admin.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey 2010-03-08 18:32:24 +00:00
parent fa3b4a47ef
commit f2bc4dd0a9
3 changed files with 6 additions and 6 deletions

View file

@ -872,10 +872,10 @@ define the details of how the relation works.
current date/time to be chosen.
Instead of a dictionary this can also be a :class:`~django.db.models.Q`
object for more :ref:`complex queries <complex-lookups-with-q>`.
``limit_choices_to`` has no effect on the inline FormSets that are created
to display related objects in the admin.
object for more :ref:`complex queries <complex-lookups-with-q>`. However,
if ``limit_choices_to`` is a :class:`~django.db.models.Q` object then it
will only have an effect on the choices available in the admin when the
field is not listed in ``raw_id_fields`` in the ``ModelAdmin`` for the model.
.. attribute:: ForeignKey.related_name