From 265444eda6712cac916d90175dbd5c4a133e8ce3 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 1 Aug 2023 19:20:23 +0300 Subject: [PATCH] 0.0.69 --- RoutesApp/js_views.py | 2 +- static/js/user_profile.js | 9 +++++++-- templates/blocks/profile/b_new_route.html | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index 3d3fb2d..ef51610 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -51,7 +51,7 @@ def edit_route_ajax(request): print(msg) return JsonResponse({'errors': msg}) - html = render_to_string('blocks/profile/b_new_route2.html', Dict, request=request) + html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request) return JsonResponse({'html': html}, status=200) diff --git a/static/js/user_profile.js b/static/js/user_profile.js index b7c119d..64e6d23 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -227,10 +227,15 @@ function onblurInputField(event,el){ // } -function sendRoute(el){ +function sendRoute(el, routeID = null){ event.preventDefault() + let route_obj = { + 'route_id': routeID + } let form = el.form; let formData = new FormData(form); + let data = new Object([route_obj, formData]) + $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, @@ -241,7 +246,7 @@ function sendRoute(el){ processData: false, contentType: false, // enctype: 'json', - data: formData, + data: JSON.stringify(data), success: function(data){ console.log('data received') // location.href = '/profile' diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index d2587e7..2ac3940 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -295,7 +295,7 @@ {% endif %}
- +