Fixed #24376 -- added verbose_name arg to UUIDField

This commit is contained in:
Michael Angeletti 2015-02-21 13:27:49 -05:00
parent 787dd6519a
commit ea3168dc6c
3 changed files with 5 additions and 3 deletions

View File

@ -2369,9 +2369,9 @@ class UUIDField(Field):
description = 'Universally unique identifier' description = 'Universally unique identifier'
empty_strings_allowed = False empty_strings_allowed = False
def __init__(self, **kwargs): def __init__(self, verbose_name=None, **kwargs):
kwargs['max_length'] = 32 kwargs['max_length'] = 32
super(UUIDField, self).__init__(**kwargs) super(UUIDField, self).__init__(verbose_name, **kwargs)
def deconstruct(self): def deconstruct(self):
name, path, args, kwargs = super(UUIDField, self).deconstruct() name, path, args, kwargs = super(UUIDField, self).deconstruct()

View File

@ -179,6 +179,8 @@ class VerboseNameField(models.Model):
field19 = models.TextField("verbose field19") field19 = models.TextField("verbose field19")
field20 = models.TimeField("verbose field20") field20 = models.TimeField("verbose field20")
field21 = models.URLField("verbose field21") field21 = models.URLField("verbose field21")
field22 = models.UUIDField("verbose field22")
field23 = models.DurationField("verbose field23")
class GenericIPAddress(models.Model): class GenericIPAddress(models.Model):

View File

@ -76,7 +76,7 @@ class BasicFieldTests(test.TestCase):
def test_field_verbose_name(self): def test_field_verbose_name(self):
m = VerboseNameField m = VerboseNameField
for i in range(1, 22): for i in range(1, 24):
self.assertEqual(m._meta.get_field('field%d' % i).verbose_name, self.assertEqual(m._meta.get_field('field%d' % i).verbose_name,
'verbose field%d' % i) 'verbose field%d' % i)