Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Illustrate when models are mixed using different related_model and the

effect on reverse queries
  • Loading branch information...
1 parent a6657a9 commit b3b56f78efdcff06729ca3fff64e0084ae238ccf @coleifer committed
Showing with 8 additions and 0 deletions.
  1. +8 −0 genericm2m/genericm2m_tests/
8 genericm2m/genericm2m_tests/
@@ -334,6 +334,8 @@ def test_custom_model_using_gfks(self):
# create some notes with custom attributes
self.note_b.related.connect(self.cereal, alias='cereal note', description='lucky charms!')
self.note_b.related.connect(self.milk, alias='milk note', description='goes good with cereal')
@@ -356,6 +358,12 @@ def test_custom_model_using_gfks(self):
(self.note_b, self.milk),
+ related_to = self.note_b.related.related_to()
+ # note that pizza does not show up here even though it is related to note b
+ # this is because that relationship was stored in a different table (RelatedObject)
+ # as opposed to AnotherRelatedObject
+ self.assertEqual(related_to.generic_objects(), [self.note_a])
cereal_rel, milk_rel = related_b
# check that the custom attributes were saved correctly

0 comments on commit b3b56f7

Please sign in to comment.
Something went wrong with that request. Please try again.