Merge pull request #260 from Sinkler/add-label

Add config labels
This commit is contained in:
Camilo Nova 2018-03-06 17:47:21 -05:00 committed by GitHub
commit a9ac3634c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)