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.
This commit is contained in:
Gabe Jackson 2014-03-04 12:23:32 +01:00 committed by Anssi Kääriäinen
parent c627da0ccc
commit b77f26313c
9 changed files with 71 additions and 27 deletions

View file

@ -245,5 +245,5 @@ class GenericRelationTests(TestCase):
form = GenericRelationForm({'links': None})
self.assertTrue(form.is_valid())
form.save()
links = HasLinkThing._meta.get_field_by_name('links')[0].field
links = HasLinkThing._meta.get_field_by_name('links')[0]
self.assertEqual(links.save_form_data_calls, 1)