0.1.2
change type_transport routines
This commit is contained in:
@@ -16,6 +16,28 @@ class CreateRouteForm(forms.ModelForm):
|
||||
'receive_msg_by_sms', 'owner', 'owner_type'
|
||||
]
|
||||
|
||||
def clean(self):
|
||||
# print('check')
|
||||
cleaned_data = super(CreateRouteForm, self).clean()
|
||||
|
||||
data = dict(self.data)
|
||||
|
||||
if 'from_place' in data and data['from_place'] not in [item[0] for item in self.fields['from_place'].choices]:
|
||||
self.cleaned_data['from_place'] = transfer_location_choices[0][0]
|
||||
if 'to_place' in data and data['to_place'] not in [item[0] for item in self.fields['to_place'].choices]:
|
||||
self.cleaned_data['to_place'] = transfer_location_choices[0][0]
|
||||
if 'cargo_type' in data and data['cargo_type'] not in [item[0] for item in self.fields['cargo_type'].choices]:
|
||||
self.cleaned_data['cargo_type'] = cargo_type_choices[0][0]
|
||||
|
||||
# reg_user = check_authorizationBy_cleaned_data(cleaned_data)
|
||||
# # print(reg_user)
|
||||
# if not reg_user:
|
||||
# raise ValidationError(_(u'Пользователь с введенными регистрационными данными не зарегистрирован. Проверьте правильность ввода e-mail и пароля.'))
|
||||
# else:
|
||||
# if not check_activate_by_user(reg_user):
|
||||
# raise ValidationError(_(u'Указанная учетная запись не была Активирована'))
|
||||
return cleaned_data
|
||||
|
||||
|
||||
# class RegistrationForm(forms.Form):
|
||||
# type_transport = forms.ChoiceField(choices=type_transport_choices, initial='avia', required=True, label='Выберите способ перевозки')
|
||||
|
||||
Reference in New Issue
Block a user