Ticket #4084: models_usstatefield.2.patch

File models_usstatefield.2.patch, 764 bytes (added by polpak <polpak@…>, 8 years ago)

fixed patch which uses the correct form field and widget

  • __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        import django.contrib.localflavor.usa.forms as USForms
     872        defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text}
     873        defaults.update(kwargs)
     874        defaults['widget'] = USForms.USStateSelect()
     875        return USForms.USStateField(**defaults)
    869876
    870877class XMLField(TextField):
    871878    def __init__(self, verbose_name=None, name=None, schema_path=None, **kwargs):
Back to Top