Code

Ticket #4084: models_usstatefield.patch

File models_usstatefield.patch, 708 bytes (added by polpak <polpak@…>, 7 years ago)

patch to django/db/models/fields/init.py for 0.96

  • __init__.py

    old new  
    866866class USStateField(Field): 
    867867    def get_manipulator_field_objs(self): 
    868868        return [oldforms.USStateField] 
     869         
     870    def formfield(self, **kwargs): 
     871        from django.contrib.localflavor.usa.forms import USStateSelect 
     872        defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text} 
     873        defaults.update(kwargs) 
     874        return USStateSelect(**defaults) 
    869875 
    870876class XMLField(TextField): 
    871877    def __init__(self, verbose_name=None, name=None, schema_path=None, **kwargs):