1
0
mirror of https://github.com/django/django.git synced 2024-12-27 19:46:22 +00:00

[1.8.x] Fixed #24376 -- added verbose_name arg to UUIDField

Backport of ea3168dc6c from master
This commit is contained in:
Michael Angeletti 2015-02-21 13:27:49 -05:00 committed by Tim Graham
parent 481d3bd617
commit 1feeefe918
3 changed files with 5 additions and 3 deletions

View File

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

View File

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

View File

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