From a727ce10fbe9888507c4a3a8c5975197cdd246ed Mon Sep 17 00:00:00 2001 From: ArtemB Date: Thu, 13 Jul 2023 15:38:11 +0300 Subject: [PATCH] 0.0.16 send new route form --- static/js/newRoute.js | 2 +- static/js/sendNewRoute.js | 20 ++++++ templates/blocks/profile/b_my_routes.html | 2 +- templates/blocks/profile/b_new_route.html | 83 ++++++++++++++++++++++- templates/forms/f_login.html | 12 ++-- 5 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 static/js/sendNewRoute.js diff --git a/static/js/newRoute.js b/static/js/newRoute.js index ef3706a..a8518f5 100644 --- a/static/js/newRoute.js +++ b/static/js/newRoute.js @@ -13,7 +13,7 @@ function createRoute(){ success: function(data){ console.log('data received') // location.href = '/profile' - document.querySelector(".profile").innerHTML = data.html + document.querySelector(".info_profile").innerHTML = data.html } }); } diff --git a/static/js/sendNewRoute.js b/static/js/sendNewRoute.js new file mode 100644 index 0000000..15be44e --- /dev/null +++ b/static/js/sendNewRoute.js @@ -0,0 +1,20 @@ +function sendRoute(){ + + $.ajax({ + headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, + url: '/ru/user_account/new_route_view/', + type: "POST", + // async: true, + cache: false, + processData: false, + contentType: false, + // enctype: 'json', + // data: {}, + success: function(data){ + console.log('data received') + // location.href = '/profile' + document.querySelector(".info_profile").innerHTML = data.html + } + }); +} + diff --git a/templates/blocks/profile/b_my_routes.html b/templates/blocks/profile/b_my_routes.html index 3a6cce8..5eadf2c 100644 --- a/templates/blocks/profile/b_my_routes.html +++ b/templates/blocks/profile/b_my_routes.html @@ -1,3 +1,3 @@
- + {{ andy }}
\ No newline at end of file diff --git a/templates/blocks/profile/b_new_route.html b/templates/blocks/profile/b_new_route.html index f5a06c3..dfbbb10 100644 --- a/templates/blocks/profile/b_new_route.html +++ b/templates/blocks/profile/b_new_route.html @@ -1,3 +1,80 @@ -
- {{ form.as_div }} -
\ No newline at end of file +
+ {% csrf_token %} +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+{#
#} +{# #} +{# #} +{#
#} +{#
#} +{# #} +{# #} +{#
#} +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
\ No newline at end of file diff --git a/templates/forms/f_login.html b/templates/forms/f_login.html index 7bd018c..13c2197 100644 --- a/templates/forms/f_login.html +++ b/templates/forms/f_login.html @@ -1,14 +1,14 @@

Войдите в профиль

-
- {% csrf_token %} + + {% csrf_token %}
{% if form.errors.all__ %} -
- {{ form.errors.all__ }} -
+ + {{ form.errors.all__ }} + + {% endif %} - {% endif %}
{% if form.username and form.errors.username %}