Merge remote-tracking branch 'origin/v2' into v2

This commit is contained in:
SBD
2025-01-15 20:51:59 +03:00

View File

@@ -35,12 +35,22 @@ class RouteForm(forms.ModelForm):
self.fields['to_city'].required = True
self.fields['type_transport'].required = True
data = None
if kwargs and 'data' in kwargs:
data= kwargs['data']
if owner_type == 'mover':
self.fields['departure_DT'].required = True
self.fields['type_transport'].choices = type_transport_choices[:-1]
else:
self.fields['type_transport'].choices = type_transport_choices
cargo_types = copy.deepcopy(cargo_type_choices)
if data and 'type_transport' in data and data['type_transport'] == 'avia':
cargo_types = cargo_types[:2] + cargo_types[3:]
self.fields['cargo_type'].choices = cargo_types
def clean(self):
# print('check')
cleaned_data = super(RouteForm, self).clean()