mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
[1.4.x] Fixed #18212 -- Standardized arguments of GenericIPAddressField
Unlike other model fields, the newly introduced (1.4)
GenericIPAddressField did not accept verbose_name and name as the
first positional arguments. This commit fixes it.
Thanks Dan McGee for the report and the patch.
Backport of 306d34873c from master.
This commit is contained in:
@@ -11,7 +11,7 @@ from django.db.models.fields.files import FieldFile
|
||||
from django.utils import unittest
|
||||
|
||||
from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post,
|
||||
NullBooleanModel, BooleanModel, Document, RenamedField)
|
||||
NullBooleanModel, BooleanModel, Document, RenamedField, VerboseNameField)
|
||||
|
||||
# If PIL available, do these tests.
|
||||
if Image:
|
||||
@@ -65,6 +65,14 @@ class BasicFieldTests(test.TestCase):
|
||||
self.assertTrue(hasattr(instance, 'get_fieldname_display'))
|
||||
self.assertFalse(hasattr(instance, 'get_modelname_display'))
|
||||
|
||||
def test_field_verbose_name(self):
|
||||
m = VerboseNameField
|
||||
for i in range(1, 23):
|
||||
self.assertEqual(m._meta.get_field('field%d' % i).verbose_name,
|
||||
'verbose field%d' % i)
|
||||
|
||||
self.assertEqual(m._meta.get_field('id').verbose_name, 'verbose pk')
|
||||
|
||||
class DecimalFieldTests(test.TestCase):
|
||||
def test_to_python(self):
|
||||
f = models.DecimalField(max_digits=4, decimal_places=2)
|
||||
|
||||
Reference in New Issue
Block a user