예제 #1
0
    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
예제 #2
0
 def clean_new_modifier(self):
     data = self.cleaned_data['new_modifier']
     return CITY_MODIFIERS.get_from_name(data)
예제 #3
0
 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])
예제 #4
0
 def clean_new_modifier(self):
     data = self.cleaned_data['new_modifier']
     return CITY_MODIFIERS.get_from_name(data)
예제 #5
0
 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])