0.7.29
fix search routes insert txt address points
This commit is contained in:
@@ -86,6 +86,11 @@ def get_profile_new_route_page_html(request, data):
|
||||
return html
|
||||
|
||||
|
||||
def get_country_n_city_str_by_type_transport_and_address_point(type_transport, address_point):
|
||||
city = get_city_by_type_transport_and_address_point(type_transport, address_point)
|
||||
return city.get_country_n_city_str()
|
||||
|
||||
|
||||
def get_city_by_type_transport_and_address_point(type_transport, address_point):
|
||||
from ReferenceDataApp.models import Airport, City
|
||||
|
||||
@@ -130,6 +135,8 @@ def get_routes_Dict(user=None, data=None):
|
||||
from_el = None
|
||||
to_el = None
|
||||
|
||||
res_Dict = {}
|
||||
|
||||
if data:
|
||||
for key, val in data.items():
|
||||
if val:
|
||||
@@ -144,6 +151,7 @@ def get_routes_Dict(user=None, data=None):
|
||||
items_list = val.split(',')
|
||||
kwargs.update({f'{key}__in': items_list})
|
||||
|
||||
|
||||
if key in (
|
||||
'departure_DT', 'arrival_DT'
|
||||
):
|
||||
@@ -158,9 +166,19 @@ def get_routes_Dict(user=None, data=None):
|
||||
|
||||
if key == 'from_address_point':
|
||||
kwargs.update({f'from_city__id': val})
|
||||
res_Dict.update({
|
||||
'from_address_point_txt': get_country_n_city_str_by_type_transport_and_address_point(
|
||||
'road', val
|
||||
)
|
||||
})
|
||||
|
||||
if key == 'to_address_point':
|
||||
kwargs.update({f'to_city__id': val})
|
||||
res_Dict.update({
|
||||
'to_address_point_txt': get_country_n_city_str_by_type_transport_and_address_point(
|
||||
'road', val
|
||||
)
|
||||
})
|
||||
|
||||
if key == 'from_el':
|
||||
from_el = int(val)
|
||||
@@ -183,7 +201,7 @@ def get_routes_Dict(user=None, data=None):
|
||||
if to_el and to_el >= routes_count:
|
||||
last_block_routes = True
|
||||
|
||||
res_Dict = {}
|
||||
|
||||
|
||||
try:
|
||||
|
||||
@@ -206,10 +224,10 @@ def get_routes_Dict(user=None, data=None):
|
||||
msg = f'get_routes_for_user get route Error = {str(e)}'
|
||||
print(msg)
|
||||
|
||||
res_Dict = {
|
||||
res_Dict.update({
|
||||
'routes': routes,
|
||||
'last_block_routes': last_block_routes
|
||||
}
|
||||
})
|
||||
return res_Dict
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user