67 lines
2.1 KiB
Python
67 lines
2.1 KiB
Python
from django.shortcuts import render
|
|
|
|
from uuid import uuid1
|
|
from .models import *
|
|
from django.contrib import auth
|
|
from django.http import HttpResponse, Http404
|
|
from django.template import loader, RequestContext
|
|
from django.contrib.auth.decorators import login_required
|
|
from BaseModels.mailSender import techSendMail
|
|
from django.utils.translation import gettext as _
|
|
from datetime import datetime
|
|
from .funcs import *
|
|
from .forms import *
|
|
from GeneralApp.funcs import get_inter_http_response
|
|
|
|
|
|
|
|
|
|
def route_search_results_View(request):
|
|
|
|
Dict = {}
|
|
data = {}
|
|
|
|
# try:
|
|
|
|
if request.GET:
|
|
data = request.GET.dict()
|
|
|
|
routes_Dict = get_routes_Dict(data=data)
|
|
if routes_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 = _('Результат поиска маршрутов')
|
|
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"]}'
|
|
|
|
Dict.update({
|
|
'page': {
|
|
'title': title,
|
|
'description': title,
|
|
'keywords': title,
|
|
}
|
|
})
|
|
|
|
t = loader.get_template('pages/p_results_find_route.html')
|
|
return get_inter_http_response(t, Dict, request)
|
|
# return HttpResponse(t.render(Dict, request))
|
|
# except Exception as e:
|
|
# msg = f'!!! --- route_search_results_View Exception {str(e)}'
|
|
# print(msg)
|
|
# raise Http404
|