mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #4415 -- Added formfield method to PositiveIntegerField, so that those fields get validated correctly. Thanks, Oggie Rob.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -912,11 +912,21 @@ class PhoneNumberField(IntegerField):
|
||||
class PositiveIntegerField(IntegerField):
|
||||
def get_manipulator_field_objs(self):
|
||||
return [oldforms.PositiveIntegerField]
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
defaults = {'min_value': 0}
|
||||
defaults.update(kwargs)
|
||||
return super(PositiveIntegerField, self).formfield(**defaults)
|
||||
|
||||
class PositiveSmallIntegerField(IntegerField):
|
||||
def get_manipulator_field_objs(self):
|
||||
return [oldforms.PositiveSmallIntegerField]
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
defaults = {'min_value': 0}
|
||||
defaults.update(kwargs)
|
||||
return super(PositiveSmallIntegerField, self).formfield(**defaults)
|
||||
|
||||
class SlugField(CharField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['max_length'] = kwargs.get('max_length', 50)
|
||||
|
||||
Reference in New Issue
Block a user