mirror of
https://github.com/django/django.git
synced 2025-07-19 00:59:17 +00:00
[1.0.x] Fixed #10367 -- Corrected an example in the documentation for GenericRelation. Thanks to George Song for the patch.
Merge of r10659 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c5bc893248
commit
5a089a5b00
@ -313,7 +313,7 @@ referred to above used fields named ``content_type_fk`` and
|
|||||||
``object_primary_key`` to create its generic foreign key, then a
|
``object_primary_key`` to create its generic foreign key, then a
|
||||||
``GenericRelation`` back to it would need to be defined like so::
|
``GenericRelation`` back to it would need to be defined like so::
|
||||||
|
|
||||||
tags = generic.GenericRelation('content_type_fk', 'object_primary_key')
|
tags = generic.GenericRelation(TaggedItem, content_type_field='content_type_fk', object_id_field='object_primary_key')
|
||||||
|
|
||||||
Of course, if you don't add the reverse relationship, you can do the
|
Of course, if you don't add the reverse relationship, you can do the
|
||||||
same types of lookups manually::
|
same types of lookups manually::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user