0.8.36 check dates when route create
This commit is contained in:
@@ -23,6 +23,9 @@ class RouteForm(forms.ModelForm):
|
||||
|
||||
|
||||
try:
|
||||
if 'departure_DT' in cleaned_data and 'arrival_DT' in cleaned_data and cleaned_data['arrival_DT'] < cleaned_data['departure_DT']:
|
||||
self.add_error('arrival_DT', _('Указана неверная дата прибытия'))
|
||||
|
||||
|
||||
if 'from_place' in self.data and self.data['from_place'] not in [item[0] for item in self.fields['from_place'].choices]:
|
||||
cleaned_data['from_place'] = self.fields['from_place'].choices[0][0]
|
||||
|
||||
Reference in New Issue
Block a user