diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 7eb57d96c9..139a096b68 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -710,7 +710,7 @@ class EmailField(CharField): class FileField(Field): def __init__(self, verbose_name=None, name=None, upload_to='', **kwargs): self.upload_to = upload_to - kwargs['max_length'] = kwargs.get('max_length', 100) + kwargs['max_length'] = kwargs.get('max_length', 100) Field.__init__(self, verbose_name, name, **kwargs) def get_db_prep_save(self, value): @@ -906,6 +906,11 @@ class NullBooleanField(Field): def get_manipulator_field_objs(self): return [oldforms.NullBooleanField] + def formfield(self, **kwargs): + defaults = {'form_class': forms.NullBooleanField} + defaults.update(kwargs) + return super(NullBooleanField, self).formfield(**defaults) + class PhoneNumberField(IntegerField): def get_manipulator_field_objs(self): return [oldforms.PhoneNumberField] @@ -922,11 +927,11 @@ 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) + return super(PositiveIntegerField, self).formfield(**defaults) class PositiveSmallIntegerField(IntegerField): def get_manipulator_field_objs(self): @@ -935,7 +940,7 @@ class PositiveSmallIntegerField(IntegerField): def formfield(self, **kwargs): defaults = {'min_value': 0} defaults.update(kwargs) - return super(PositiveSmallIntegerField, self).formfield(**defaults) + return super(PositiveSmallIntegerField, self).formfield(**defaults) class SlugField(CharField): def __init__(self, *args, **kwargs):