Code

Ticket #4067: 4067.patch

File 4067.patch, 664 bytes (added by Collin Grady <cgrady@…>, 7 years ago)
  • django/db/models/fields/__init__.py

     
    732732        kwargs['maxlength'] = 15 
    733733        Field.__init__(self, *args, **kwargs) 
    734734 
     735    def formfield(self, **kwargs): 
     736        defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text} 
     737        defaults.update(kwargs) 
     738        return forms.RegexField(validators.ip4_re, **defaults) 
     739 
    735740    def get_manipulator_field_objs(self): 
    736741        return [oldforms.IPAddressField] 
    737742