2.1.25 fix edit_route
This commit is contained in:
@@ -84,17 +84,17 @@ def raise_route_ajax(request):
|
|||||||
|
|
||||||
if not data or not 'route_id' in data:
|
if not data or not 'route_id' in data:
|
||||||
msg = _('Недостаточно данных')
|
msg = _('Недостаточно данных')
|
||||||
return JsonResponse({'errors': msg})
|
return JsonResponse({'errors': msg}, status=400)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
route = Route.objects.get(owner=request.user, id=data['route_id'])
|
route = Route.objects.get(owner=request.user, id=data['route_id'])
|
||||||
except Route.DoesNotExist:
|
except Route.DoesNotExist:
|
||||||
msg = _('Не найден маршрут')
|
msg = _('Не найден маршрут')
|
||||||
return JsonResponse({'errors': msg})
|
return JsonResponse({'errors': msg}, status=400)
|
||||||
|
|
||||||
if not route.get_permission_for_raise():
|
if not route.get_permission_for_raise():
|
||||||
msg = _('Нет доступных поднятий')
|
msg = _('Нет доступных поднятий')
|
||||||
return JsonResponse({'errors': msg})
|
return JsonResponse({'errors': msg}, status=400)
|
||||||
|
|
||||||
route.rising_DT = datetime.now()
|
route.rising_DT = datetime.now()
|
||||||
route.save(update_fields=['rising_DT'])
|
route.save(update_fields=['rising_DT'])
|
||||||
@@ -177,11 +177,11 @@ def edit_route_ajax(request):
|
|||||||
form = get_cargo_types_by_type_transport(route.type_transport, form)
|
form = get_cargo_types_by_type_transport(route.type_transport, form)
|
||||||
# routeForm_assign_choices_by_type_transport(form, route.type_transport)
|
# routeForm_assign_choices_by_type_transport(form, route.type_transport)
|
||||||
|
|
||||||
route_address_points_Dict = route.get_address_points()
|
# route_address_points_Dict = route.get_address_points()
|
||||||
form.initial.update({
|
# form.initial.update({
|
||||||
'from_address_point_txt': route_address_points_Dict['from_address_point_txt'],
|
# 'from_address_point_txt': route_address_points_Dict['from_address_point_txt'],
|
||||||
'to_address_point_txt': route_address_points_Dict['to_address_point_txt'],
|
# 'to_address_point_txt': route_address_points_Dict['to_address_point_txt'],
|
||||||
})
|
# })
|
||||||
|
|
||||||
|
|
||||||
Dict = {
|
Dict = {
|
||||||
|
|||||||
Reference in New Issue
Block a user