From 06219e8f699cfa9f1c176b7a3564edc94668fab1 Mon Sep 17 00:00:00 2001 From: SDE Date: Sat, 23 Sep 2023 15:46:21 +0300 Subject: [PATCH] 0.7.44 dates in route search --- RoutesApp/funcs.py | 8 ++++++-- TWB/settings.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RoutesApp/funcs.py b/RoutesApp/funcs.py index ebe18fc..4652cbe 100644 --- a/RoutesApp/funcs.py +++ b/RoutesApp/funcs.py @@ -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: diff --git a/TWB/settings.py b/TWB/settings.py index ccc1e4c..f634ec4 100644 --- a/TWB/settings.py +++ b/TWB/settings.py @@ -226,7 +226,7 @@ CKEDITOR_CONFIGS = { 'height': 291, 'width': '70vw', 'filebrowserWindowHeight': 600, - 'filebrowserWindowWidth': "100%", + 'filebrowserWindowWidth': "90%", 'toolbar': 'Custom', 'forcePasteAsPlainText': True, 'allowedContent': True,