dates in route search
This commit is contained in:
SDE
2023-09-23 15:46:21 +03:00
parent 2f5485cc25
commit 06219e8f69
2 changed files with 7 additions and 3 deletions

View File

@@ -155,7 +155,11 @@ def get_routes_Dict(user=None, data=None):
if key in (
'departure_DT', 'arrival_DT'
):
kwargs.update({f'{key}__date': datetime.strptime(val, '%Y-%m-%d')})
dates = val.split(' - ')
kwargs.update({
f'{key}__date__gte': datetime.strptime(dates[0], '%d.%m.%Y'),
f'{key}__date__lte': datetime.strptime(dates[1], '%d.%m.%Y').replace(hour=23, minute=59, second=59)
})
if key not in (
'from_address_point_txt', 'to_address_point_txt', 'csrfmiddlewaretoken', 'sort', 'weight',
@@ -185,7 +189,7 @@ def get_routes_Dict(user=None, data=None):
if key == 'to_el':
to_el = int(val)
routes = Route.objects.filter(**kwargs).order_by('-modifiedDT')
routes = Route.objects.filter(**kwargs).order_by('departure_DT', 'arrival_DT', '-modifiedDT')
routes_count = routes.count()
if from_el and to_el:

View File

@@ -226,7 +226,7 @@ CKEDITOR_CONFIGS = {
'height': 291,
'width': '70vw',
'filebrowserWindowHeight': 600,
'filebrowserWindowWidth': "100%",
'filebrowserWindowWidth': "90%",
'toolbar': 'Custom',
'forcePasteAsPlainText': True,
'allowedContent': True,