mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #16508 -- Renamed the current "virtual" fields to "private".
The only reason why GenericForeignKey and GenericRelation are stored separately inside _meta is that they need to be cloned for every model subclass, but that's not true for any other virtual field. Actually, it's only true for GenericRelation.
This commit is contained in:
committed by
Tim Graham
parent
47fbbc33de
commit
c339a5a6f7
@@ -157,11 +157,11 @@ class RelatedObjectsTests(OptionsBaseTests):
|
||||
)
|
||||
|
||||
|
||||
class VirtualFieldsTests(OptionsBaseTests):
|
||||
class PrivateFieldsTests(OptionsBaseTests):
|
||||
|
||||
def test_virtual_fields(self):
|
||||
for model, expected_names in TEST_RESULTS['virtual_fields'].items():
|
||||
objects = model._meta.virtual_fields
|
||||
def test_private_fields(self):
|
||||
for model, expected_names in TEST_RESULTS['private_fields'].items():
|
||||
objects = model._meta.private_fields
|
||||
self.assertEqual(sorted([f.name for f in objects]), sorted(expected_names))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user