mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +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:
parent
47fbbc33de
commit
c339a5a6f7
14 changed files with 86 additions and 39 deletions
|
@ -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))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue