diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-16 22:44:42 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-16 22:44:42 +0000 |
| commit | f505bd6e415fc771c920b19432dd10941a743097 (patch) | |
| tree | 59d2898ea77a0c1968402684bf34dbb98f5f3119 /docs | |
| parent | 7c6071861e6402be75dd6bcfe155a16799e01eba (diff) | |
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
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/contenttypes.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/contenttypes.txt b/docs/contenttypes.txt index a07ff5d70d..84e38020bc 100644 --- a/docs/contenttypes.txt +++ b/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* +work:: + + # This will fail + >>> TaggedItem.objects.filter(content_object=guido) + # This will also fail + >>> TaggedItem.objects.get(content_object=guido) + Reverse generic relations ------------------------- |
