2.1.34 route_search_results_View fix cities
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
from uuid import uuid1
|
||||
|
||||
from ReferenceDataApp.funcs import get_city_by_id
|
||||
from .models import *
|
||||
from django.contrib import auth
|
||||
from django.http import HttpResponse, Http404
|
||||
@@ -39,17 +41,23 @@ def route_search_results_View(request):
|
||||
'page_type': 'routes',
|
||||
'next_page_els_count': routes_Dict['next_page_els_count'],
|
||||
}
|
||||
if 'from_address_point_txt' in routes_Dict:
|
||||
data.update({'from_address_point_txt': routes_Dict['from_address_point_txt']})
|
||||
if 'to_address_point_txt' in routes_Dict:
|
||||
data.update({'to_address_point_txt': routes_Dict['to_address_point_txt']})
|
||||
|
||||
from_city = None
|
||||
to_city = None
|
||||
if 'from_city' in data and data['from_city']:
|
||||
from_city = get_city_by_id(data['from_city'])
|
||||
data.update({'from_city': from_city})
|
||||
if 'to_city' in data and data['to_city']:
|
||||
to_city = get_city_by_id(data['to_city'])
|
||||
data.update({'to_city': to_city})
|
||||
|
||||
Dict.update({'route_form': RouteForm(initial=data, owner_type=owner_type)})
|
||||
|
||||
title = _('Результат поиска маршрутов')
|
||||
if 'from_address_point_txt' in data:
|
||||
title = f'{title} из {data["from_address_point_txt"]}'
|
||||
if 'to_address_point_txt' in data:
|
||||
title = f'{title} в {data["to_address_point_txt"]}'
|
||||
if from_city:
|
||||
title = f'{title} из {from_city.name}'
|
||||
if to_city:
|
||||
title = f'{title} в {to_city.name}'
|
||||
|
||||
Dict.update({
|
||||
'page': {
|
||||
|
||||
Reference in New Issue
Block a user