add config labels

This commit is contained in:
Anton Shurashov 2018-03-06 13:16:44 +03:00
parent 2cec39d609
commit 40188c093a
2 changed files with 12 additions and 0 deletions

View file

@ -309,6 +309,14 @@ class Config(object):
def app_config(self):
return apps.get_app_config(self.app_label)
@property
def label(self):
return '%s.%s' % (self.app_label, self.object_name)
@property
def label_lower(self):
return '%s.%s' % (self.app_label, self.model_name)
_meta = Meta()

View file

@ -104,3 +104,7 @@ class TestAdmin(TestCase):
content_str.find('LONG_VALUE'),
content_str.find('INT_VALUE')
)
def test_labels(self):
self.assertEqual(type(self.model._meta.label), str)
self.assertEqual(type(self.model._meta.label_lower), str)