From 41e4b2331730e916a8c0f155a524d538c9edc000 Mon Sep 17 00:00:00 2001 From: SDE Date: Mon, 9 Sep 2024 16:45:20 +0300 Subject: [PATCH] 1.6.18 fix reset highlight after change route --- RoutesApp/js_views.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index dc81849..0f7cb66 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -1,4 +1,5 @@ import json +from copy import deepcopy from django.shortcuts import render @@ -347,6 +348,7 @@ def create_or_change_route_ajax(request, route_id=None): lang = get_and_set_lang(request) Dict = {} + route_old_Dict = None try: @@ -361,6 +363,7 @@ def create_or_change_route_ajax(request, route_id=None): if route: form = RouteForm(data, instance=route) Dict.update({'route': route}) + route_old_Dict = deepcopy(route.__dict__) else: form = RouteForm(data) @@ -381,6 +384,16 @@ def create_or_change_route_ajax(request, route_id=None): if obj.to_address_point: obj.to_city = get_city_by_type_transport_and_address_point(obj.type_transport, obj.to_address_point) + if route_old_Dict: + if route_old_Dict['highlight_color'] != obj.highlight_color: + obj.highlight_color = route_old_Dict['highlight_color'] + + if route_old_Dict['highlight_end_DT'] != obj.highlight_end_DT: + obj.highlight_end_DT = route_old_Dict['highlight_end_DT'] + + if route_old_Dict['rising_DT'] != obj.rising_DT: + obj.rising_DT = route_old_Dict['rising_DT'] + obj.owner = request.user obj.save()