get routes
This commit is contained in:
SDE
2023-07-26 16:22:26 +03:00
parent 9c58c20c31
commit 5688746e4f

View File

@@ -39,6 +39,8 @@ def get_routes_ajax(request):
for route in routes: for route in routes:
try:
if route.type_transport == 'avia': if route.type_transport == 'avia':
route.from_airport = Airport.objects.get(id=route.from_address_point) route.from_airport = Airport.objects.get(id=route.from_address_point)
route.to_airport = Airport.objects.get(id=route.to_address_point) route.to_airport = Airport.objects.get(id=route.to_address_point)
@@ -50,6 +52,9 @@ def get_routes_ajax(request):
route.from_country = route.from_city.country route.from_country = route.from_city.country
route.to_country = route.from_city.country route.to_country = route.from_city.country
except Exception as e:
msg = f'get route points = {str(e)}'
print(msg)
Dict = { Dict = {
'routes': routes 'routes': routes
@@ -69,8 +74,7 @@ def get_routes_ajax(request):
'all__': f'ошибка в запросе = {str(e)}' 'all__': f'ошибка в запросе = {str(e)}'
} }
} }
html = render_to_string('blocks/profile/b_new_route.html', errors_Dict, request=request) return JsonResponse(errors_Dict, status=400)
return JsonResponse({'html': html}, status=400)