Skip to content

Commit

Permalink
Fixed #7785 -- Added a note in the contenttypes documentation that Ge…
Browse files Browse the repository at this point in the history
…nericRelations must share a common field type for primary keys. Thanks to Rudolph for the suggestion and initial draft.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Jul 19, 2008
1 parent 825622d commit b5b0feb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/contenttypes.txt
Expand Up @@ -205,6 +205,11 @@ model. There are three parts to setting up a ``GenericForeignKey``:
models you'll be relating to. (For most models, this means an
``IntegerField`` or ``PositiveIntegerField``.)

This field must be of the same type as the primary key of the models
that will be involved in the generic relation. For example, if you use
``IntegerField``, you won't be able to form a generic relation with a
model that uses a ``CharField`` as a primary key.

3. Give your model a ``GenericForeignKey``, and pass it the names of
the two fields described above. If these fields are named
"content_type" and "object_id", you can omit this -- those are the
Expand Down

0 comments on commit b5b0feb

Please sign in to comment.