0.0.10
registration form routines
This commit is contained in:
@@ -1,16 +1,23 @@
|
||||
# # coding=utf-8
|
||||
# from django import forms
|
||||
# from django.contrib.auth.forms import AuthenticationForm
|
||||
# from django.utils.translation import ugettext_lazy as _
|
||||
# from django.core.exceptions import ValidationError
|
||||
# from .models import *
|
||||
# # from djng.styling.bootstrap3.forms import Bootstrap3ModelForm
|
||||
# # from djng.forms import fields, NgModelFormMixin, NgFormValidationMixin, NgModelForm
|
||||
# # from datetimepicker.widgets import DateTimePicker
|
||||
# # from datetimepicker.helpers import js_loader_url
|
||||
#
|
||||
#
|
||||
#
|
||||
from django import forms
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.core.exceptions import ValidationError
|
||||
from .models import *
|
||||
# from djng.styling.bootstrap3.forms import Bootstrap3ModelForm
|
||||
# from djng.forms import fields, NgModelFormMixin, NgFormValidationMixin, NgModelForm
|
||||
# from datetimepicker.widgets import DateTimePicker
|
||||
# from datetimepicker.helpers import js_loader_url
|
||||
|
||||
class RegistrationForm(forms.Form):
|
||||
firstname = forms.CharField(required=False)
|
||||
lastname = forms.CharField(required=False)
|
||||
email = forms.EmailField()
|
||||
password = forms.CharField(widget=forms.PasswordInput())
|
||||
confirm_password = forms.CharField(widget=forms.PasswordInput())
|
||||
tel = forms.CharField()
|
||||
|
||||
|
||||
# # class PersonForm(NgModelFormMixin, NgFormValidationMixin, NgModelForm, Bootstrap3ModelForm):
|
||||
# #
|
||||
# # form_name = 'person_form'
|
||||
|
||||
@@ -9,6 +9,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from BaseModels.mailSender import techSendMail
|
||||
from django.utils.translation import gettext as _
|
||||
from datetime import datetime
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
def registration_ajax(request):
|
||||
if request.method != 'POST':
|
||||
@@ -18,6 +19,14 @@ def registration_ajax(request):
|
||||
|
||||
data = request.POST
|
||||
|
||||
from .forms import RegistrationForm
|
||||
form = RegistrationForm(data)
|
||||
if not form.is_valid():
|
||||
Dict = {'form': form}
|
||||
html = render_to_string('forms/f_registration.html', Dict)
|
||||
return JsonResponse({'html': html}, status=400)
|
||||
|
||||
|
||||
res_data = {
|
||||
'errors': 'тестовый верный ответ'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user