0.12.32 fix switch langs
This commit is contained in:
@@ -78,7 +78,7 @@ def del_amp_symbols(value):
|
|||||||
@stringfilter
|
@stringfilter
|
||||||
def del_lang_from_path(value):
|
def del_lang_from_path(value):
|
||||||
path_list = value.split('/')
|
path_list = value.split('/')
|
||||||
path = '/' + '/'.join(path_list[2:])
|
path = '/' + '/'.join(path_list[4:])
|
||||||
|
|
||||||
# for i in path_list[1:]:
|
# for i in path_list[1:]:
|
||||||
# path.join(i + '/')
|
# path.join(i + '/')
|
||||||
|
|||||||
@@ -19,42 +19,46 @@ from GeneralApp.funcs import get_inter_http_respose
|
|||||||
def route_search_results_View(request):
|
def route_search_results_View(request):
|
||||||
|
|
||||||
Dict = {}
|
Dict = {}
|
||||||
data = None
|
data = {}
|
||||||
|
|
||||||
if request.GET:
|
try:
|
||||||
data = request.GET.dict()
|
|
||||||
|
|
||||||
routes_Dict = get_routes_Dict(data=data)
|
if request.GET:
|
||||||
if routes_Dict:
|
data = request.GET.dict()
|
||||||
Dict = {
|
|
||||||
'routes': routes_Dict['routes'],
|
|
||||||
'last_block': routes_Dict['last_block'],
|
|
||||||
'show_filter_and_results': True,
|
|
||||||
'owner_type': data['owner_type'],
|
|
||||||
'last_el': routes_Dict['last_el'],
|
|
||||||
'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']})
|
|
||||||
Dict.update({'route_form': RouteForm(initial=data)})
|
|
||||||
|
|
||||||
title = _('Результат поиска маршрутов')
|
routes_Dict = get_routes_Dict(data=data)
|
||||||
if 'from_address_point_txt' in data:
|
if routes_Dict:
|
||||||
title = f'{title} из {data["from_address_point_txt"]}'
|
Dict = {
|
||||||
if 'to_address_point_txt' in data:
|
'routes': routes_Dict['routes'],
|
||||||
title = f'{title} в {data["to_address_point_txt"]}'
|
'last_block': routes_Dict['last_block'],
|
||||||
|
'show_filter_and_results': True,
|
||||||
|
'owner_type': data['owner_type'],
|
||||||
|
'last_el': routes_Dict['last_el'],
|
||||||
|
'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']})
|
||||||
|
Dict.update({'route_form': RouteForm(initial=data)})
|
||||||
|
|
||||||
Dict.update({
|
title = _('Результат поиска маршрутов')
|
||||||
'page': {
|
if 'from_address_point_txt' in data:
|
||||||
'title': title,
|
title = f'{title} из {data["from_address_point_txt"]}'
|
||||||
'description': title,
|
if 'to_address_point_txt' in data:
|
||||||
'keywords': title,
|
title = f'{title} в {data["to_address_point_txt"]}'
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
t = loader.get_template('pages/p_results_find_route.html')
|
Dict.update({
|
||||||
return get_inter_http_respose(t, Dict, request)
|
'page': {
|
||||||
|
'title': title,
|
||||||
|
'description': title,
|
||||||
|
'keywords': title,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t = loader.get_template('pages/p_results_find_route.html')
|
||||||
|
return get_inter_http_respose(t, Dict, request)
|
||||||
# return HttpResponse(t.render(Dict, request))
|
# return HttpResponse(t.render(Dict, request))
|
||||||
|
except Exception as e:
|
||||||
|
raise Http404
|
||||||
|
|||||||
@@ -49,8 +49,8 @@
|
|||||||
<div onclick="showLang(this)" class="dropdown_lang">
|
<div onclick="showLang(this)" class="dropdown_lang">
|
||||||
<div id="dropbtn_lang" class="dropbtn_lang">RU</div>
|
<div id="dropbtn_lang" class="dropbtn_lang">RU</div>
|
||||||
<div class="dropdown-content-lang">
|
<div class="dropdown-content-lang">
|
||||||
<a id="ru_lang" href="/ru{{ request.path|del_lang_from_path }}">RU</a>
|
<a id="ru_lang" href="/ru{{ request.build_absolute_uri|del_lang_from_path }}">RU</a>
|
||||||
<a id="en_lang" href="/en{{ request.path|del_lang_from_path }}">EN</a>
|
<a id="en_lang" href="/en{{ request.build_absolute_uri|del_lang_from_path }}">EN</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user