0.0.17
login routines
This commit is contained in:
@@ -10,4 +10,5 @@ urlpatterns = [
|
|||||||
path('login/', login_ajax, name='login_ajax'),
|
path('login/', login_ajax, name='login_ajax'),
|
||||||
|
|
||||||
path('new_route_view/', new_route_view_ajax, name='new_route_view_ajax'),
|
path('new_route_view/', new_route_view_ajax, name='new_route_view_ajax'),
|
||||||
|
path('my_routes/', my_routes_ajax, name='my_routes_ajax'),
|
||||||
]
|
]
|
||||||
@@ -13,6 +13,18 @@ from django.template.loader import render_to_string
|
|||||||
from django.urls import reverse
|
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):
|
def new_route_view_ajax(request):
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
@@ -39,7 +51,7 @@ def login_ajax(request):
|
|||||||
form = LoginForm(data)
|
form = LoginForm(data)
|
||||||
if not form.is_valid():
|
if not form.is_valid():
|
||||||
Dict = {'form': form}
|
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)
|
return JsonResponse({'html': html}, status=400)
|
||||||
|
|
||||||
from django.contrib.auth import authenticate
|
from django.contrib.auth import authenticate
|
||||||
|
|||||||
3
templates/blocks/profile/b_my_routes.html
Normal file
3
templates/blocks/profile/b_my_routes.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user