Documented that GenericForeignKey fields can't be used transparently in
filters. Refs #3006. Patch from rmyers. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8417 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7c6071861e
commit
f505bd6e41
|
@ -227,6 +227,16 @@ creating a ``TaggedItem``::
|
||||||
>>> t.content_object
|
>>> t.content_object
|
||||||
<User: Guido>
|
<User: Guido>
|
||||||
|
|
||||||
|
Due to the way ``GenericForeignKey`` is implemeneted, you cannot use such
|
||||||
|
fields directly with filters (``filter()`` and ``exclude()``, for example) via
|
||||||
|
the database API. They aren't normal field objects. These examples will *not*
|
||||||
|
work::
|
||||||
|
|
||||||
|
# This will fail
|
||||||
|
>>> TaggedItem.objects.filter(content_object=guido)
|
||||||
|
# This will also fail
|
||||||
|
>>> TaggedItem.objects.get(content_object=guido)
|
||||||
|
|
||||||
Reverse generic relations
|
Reverse generic relations
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue