From 9eb73e74ffb4d9fd955b1c1dc0abff56b2111aa8 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 11 Jul 2023 15:59:09 +0300 Subject: [PATCH] 0.0.17 login routines --- AuthApp/js_urls.py | 1 + AuthApp/js_views.py | 14 +++++++++++++- templates/blocks/profile/b_my_routes.html | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 templates/blocks/profile/b_my_routes.html diff --git a/AuthApp/js_urls.py b/AuthApp/js_urls.py index 4bc13b0..10bf2f4 100644 --- a/AuthApp/js_urls.py +++ b/AuthApp/js_urls.py @@ -10,4 +10,5 @@ urlpatterns = [ path('login/', login_ajax, name='login_ajax'), path('new_route_view/', new_route_view_ajax, name='new_route_view_ajax'), + path('my_routes/', my_routes_ajax, name='my_routes_ajax'), ] \ No newline at end of file diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index 02c14b5..34608c0 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -13,6 +13,18 @@ from django.template.loader import render_to_string from django.urls import reverse +def my_routes_ajax(request): + if request.method != 'POST': + raise Http404 + + from RoutesApp.forms import RegistrationForm + Dict = { + 'form': RegistrationForm() + } + + html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request) + return JsonResponse({'html': html}, status=200) + def new_route_view_ajax(request): if request.method != 'POST': @@ -39,7 +51,7 @@ def login_ajax(request): form = LoginForm(data) if not form.is_valid(): Dict = {'form': form} - html = render_to_string('forms/f_registration.html', Dict, request=request) + html = render_to_string('forms/f_login.html.html', Dict, request=request) return JsonResponse({'html': html}, status=400) from django.contrib.auth import authenticate diff --git a/templates/blocks/profile/b_my_routes.html b/templates/blocks/profile/b_my_routes.html new file mode 100644 index 0000000..3a6cce8 --- /dev/null +++ b/templates/blocks/profile/b_my_routes.html @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file