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')
|
||||
|
||||
@@ -51,6 +51,7 @@ INSTALLED_APPS = [
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
|
||||
@@ -8,8 +8,8 @@ urlpatterns = [
|
||||
# path('admin/', admin.site.urls),
|
||||
path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||
|
||||
# path('', include('GeneralApp.urls')),
|
||||
# url(r'^i18n/', include('django.conf.urls.i18n')),
|
||||
|
||||
path('i18n/', include('django.conf.urls.i18n')),
|
||||
]
|
||||
|
||||
from django.conf.urls.i18n import i18n_patterns
|
||||
@@ -18,6 +18,8 @@ urlpatterns += i18n_patterns(
|
||||
|
||||
path('', include('GeneralApp.urls')),
|
||||
path('', include('AuthApp.urls')),
|
||||
|
||||
path('user_account/', include('AuthApp.js_urls')),
|
||||
)
|
||||
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
Reference in New Issue
Block a user