def deserialize(cls, data): obj = cls() obj.modifier_id = CITY_MODIFIERS(data['modifier_id']) obj.modifier_name = data['modifier_name'] obj.place_id = data['place_id'] obj.old_name_forms = utg_words.Word.deserialize(data['old_name_forms']) obj.old_modifier_name = data.get('old_modifier_name') return obj
def clean_new_modifier(self): data = self.cleaned_data['new_modifier'] return CITY_MODIFIERS.get_from_name(data)
def __init__(self, *args, **kwargs): super(UserForm, self).__init__(*args, **kwargs) self.fields['place'].choices = places_storage.get_choices() self.fields['new_modifier'].choices = sorted(CITY_MODIFIERS.choices(), key=lambda m: m[1])