Skip to content
Browse files

Documented that GenericForeignKey fields can't be used transparently in

filters. Refs #3006. Patch from rmyers.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 7c60718 commit f505bd6e415fc771c920b19432dd10941a743097 @malcolmt malcolmt committed
Showing with 10 additions and 0 deletions.
  1. +10 −0 docs/contenttypes.txt
10 docs/contenttypes.txt
@@ -227,6 +227,16 @@ creating a ``TaggedItem``::
>>> t.content_object
<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*
+ # This will fail
+ >>> TaggedItem.objects.filter(content_object=guido)
+ # This will also fail
+ >>> TaggedItem.objects.get(content_object=guido)
Reverse generic relations

0 comments on commit f505bd6

Please sign in to comment.
Something went wrong with that request. Please try again.