diff options
| author | Gabe Jackson <gabejackson@cxg.ch> | 2014-03-04 12:23:32 +0100 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2014-03-05 22:37:53 +0200 |
| commit | b77f26313cddbfde20dcf2661e9bd35458c2d1bd (patch) | |
| tree | ed655a90373cf606e304e82eaeceaf025c892328 /tests/generic_relations/models.py | |
| parent | c627da0ccc12861163f28177aa7538b420a9d310 (diff) | |
Fixed #22207 -- Added support for GenericRelation reverse lookups
GenericRelation now supports an optional related_query_name argument.
Setting related_query_name adds a relation from the related object back to
the content type for filtering, ordering and other query operations.
Thanks to Loic Bistuer for spotting a couple of important issues in
his review.
Diffstat (limited to 'tests/generic_relations/models.py')
| -rw-r--r-- | tests/generic_relations/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/generic_relations/models.py b/tests/generic_relations/models.py index 436f26afb6..5d24e017a2 100644 --- a/tests/generic_relations/models.py +++ b/tests/generic_relations/models.py @@ -68,7 +68,7 @@ class Animal(models.Model): common_name = models.CharField(max_length=150) latin_name = models.CharField(max_length=150) - tags = GenericRelation(TaggedItem) + tags = GenericRelation(TaggedItem, related_query_name='animal') comparisons = GenericRelation(Comparison, object_id_field="object_id1", content_type_field="content_type1") @@ -116,7 +116,7 @@ class Rock(Mineral): class ManualPK(models.Model): id = models.IntegerField(primary_key=True) - tags = GenericRelation(TaggedItem) + tags = GenericRelation(TaggedItem, related_query_name='manualpk') class ForProxyModelModel(models.Model): |
