0.0.8
ajax registration def
This commit is contained in:
10
AuthApp/js_urls.py
Normal file
10
AuthApp/js_urls.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# coding=utf-8
|
||||
from django.urls import path
|
||||
# from AuthApp.js_views import *
|
||||
# from AuthApp.import_funcs import *
|
||||
from AuthApp.js_views import *
|
||||
from django.contrib.auth import views
|
||||
|
||||
urlpatterns = [
|
||||
path('registration/', registration_ajax, name='registration_ajax'),
|
||||
]
|
||||
32
AuthApp/js_views.py
Normal file
32
AuthApp/js_views.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
from uuid import uuid1
|
||||
from AuthApp.models import *
|
||||
from django.contrib import auth
|
||||
from django.http import HttpResponse, Http404, JsonResponse
|
||||
from django.template import loader, RequestContext
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from BaseModels.mailSender import techSendMail
|
||||
from django.utils.translation import gettext as _
|
||||
from datetime import datetime
|
||||
|
||||
def registration_ajax(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
try:
|
||||
|
||||
data = request.POST
|
||||
|
||||
res_data = {
|
||||
'errors': 'тестовый верный ответ'
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
|
||||
res_data = {
|
||||
'errors': f'ошибка в запросе = {str(e)}'
|
||||
}
|
||||
|
||||
|
||||
return JsonResponse(res_data)
|
||||
@@ -15,11 +15,6 @@ from datetime import datetime
|
||||
|
||||
def registration_View(request):
|
||||
|
||||
# if request.method != 'POST':
|
||||
# raise Http404
|
||||
#
|
||||
# data = request.POST
|
||||
|
||||
Dict = {}
|
||||
|
||||
t = loader.get_template('pages/p_registration.html')
|
||||
|
||||
Reference in New Issue
Block a user