mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of Code 2014 project and everyone else who helped with the patch!
This commit is contained in:
parent
749d23251b
commit
fb48eb0581
58 changed files with 2851 additions and 1195 deletions
|
@ -1020,7 +1020,7 @@ class DBConstraintTestCase(TestCase):
|
|||
self.assertEqual(models.Object.objects.count(), 2)
|
||||
self.assertEqual(obj.related_objects.count(), 1)
|
||||
|
||||
intermediary_model = models.Object._meta.get_field_by_name("related_objects")[0].rel.through
|
||||
intermediary_model = models.Object._meta.get_field("related_objects").rel.through
|
||||
intermediary_model.objects.create(from_object_id=obj.id, to_object_id=12345)
|
||||
self.assertEqual(obj.related_objects.count(), 1)
|
||||
self.assertEqual(intermediary_model.objects.count(), 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue