From 1feeefe918e0f6ea6d633855549310dd149baed5 Mon Sep 17 00:00:00 2001 From: Michael Angeletti Date: Sat, 21 Feb 2015 13:27:49 -0500 Subject: [PATCH] [1.8.x] Fixed #24376 -- added verbose_name arg to UUIDField Backport of ea3168dc6ced391d848c511a14cfcecfeac9d401 from master --- django/db/models/fields/__init__.py | 4 ++-- tests/model_fields/models.py | 2 ++ tests/model_fields/tests.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 19f090863b..e0534b823b 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -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() diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index 3d25c89607..c988fce246 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -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): diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 080808520f..81f62b6e3d 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -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)