2.1.16 change cargo_type and transport_type names
This commit is contained in:
@@ -10,8 +10,19 @@ from django.db.models import F, Q
|
||||
elements_on_page = 25
|
||||
|
||||
|
||||
def get_cargo_types_by_type_transport(type_transport, form=None):
|
||||
cargo_types = copy.deepcopy(cargo_type_choices)
|
||||
if type_transport in ['avia']:
|
||||
cargo_types = cargo_types[:2] + cargo_types[3:]
|
||||
|
||||
if not form:
|
||||
return cargo_types
|
||||
|
||||
form.fields['cargo_type'].choices = cargo_types
|
||||
|
||||
form.base_fields['cargo_type'].choices = cargo_types
|
||||
|
||||
return form
|
||||
|
||||
|
||||
|
||||
@@ -28,53 +39,13 @@ def get_profile_new_route_page_html(request, data):
|
||||
|
||||
errors_off = True
|
||||
|
||||
# if 'from_address_point' in data:
|
||||
# del data['from_address_point']
|
||||
# if 'from_address_point_txt' in data:
|
||||
# del data['from_address_point_txt']
|
||||
#
|
||||
# if 'to_address_point' in data:
|
||||
# del data['to_address_point']
|
||||
# if 'to_address_point_txt' in data:
|
||||
# del data['to_address_point_txt']
|
||||
|
||||
|
||||
# if data['type_transport'] == 'avia':
|
||||
# transfer_location_choices = (
|
||||
# ('airport', _('В аэропорту')),
|
||||
# ('city', _('По городу')),
|
||||
# ('other', _('По договоренности'))
|
||||
# )
|
||||
#
|
||||
# cargo_type_choices = (
|
||||
# ('cargo', _('Груз')),
|
||||
# ('parcel', _('Бандероль')),
|
||||
# ('package', _('Посылка')),
|
||||
# ('letter', _('Письмо\Документ'))
|
||||
# )
|
||||
#
|
||||
#
|
||||
# else:
|
||||
# transfer_location_choices = (
|
||||
# ('city', _('По городу')),
|
||||
# ('other', _('По договоренности'))
|
||||
# )
|
||||
#
|
||||
# cargo_type_choices = (
|
||||
# ('passenger', _('Пассажир')),
|
||||
# ('cargo', _('Груз')),
|
||||
# ('parcel', _('Бандероль')),
|
||||
# ('package', _('Посылка')),
|
||||
# ('letter', _('Письмо\Документ'))
|
||||
# )
|
||||
|
||||
form = RouteForm(data)
|
||||
if not form.is_valid():
|
||||
pass
|
||||
form = RouteForm(initial=form.cleaned_data)
|
||||
|
||||
if 'type_transport' in data:
|
||||
form = routeForm_assign_choices_by_type_transport(form, data['type_transport'])
|
||||
form = get_cargo_types_by_type_transport(data['type_transport'], form)
|
||||
|
||||
|
||||
if 'owner_type' in data:
|
||||
|
||||
Reference in New Issue
Block a user