mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-23 16:32:15 +00:00
Working saving of registration data, need this doesn't create the required registration profile though.
Might need to find a way to invoke automatically then just append the new user data to the end.
This commit is contained in:
@@ -11,8 +11,7 @@ urlpatterns = patterns('',
|
|||||||
# url(r'^blog/', include('blog.urls')),
|
# url(r'^blog/', include('blog.urls')),
|
||||||
|
|
||||||
url(r'^', include('RIGS.urls')),
|
url(r'^', include('RIGS.urls')),
|
||||||
url('^user/register/$', RegistrationView.as_view(form_class=RIGS.forms.ProfileRegistrationFormUniqueEmail),
|
url('^user/register/$', RIGS.views.ProfileRegistrationView.as_view()),
|
||||||
name="registration_register"),
|
|
||||||
url('^user/', include('django.contrib.auth.urls')),
|
url('^user/', include('django.contrib.auth.urls')),
|
||||||
url('^user/', include('registration.backends.default.urls')),
|
url('^user/', include('registration.backends.default.urls')),
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
|||||||
last_name = forms.CharField(required=False, max_length=50)
|
last_name = forms.CharField(required=False, max_length=50)
|
||||||
initials = forms.CharField(required=True, max_length=5)
|
initials = forms.CharField(required=True, max_length=5)
|
||||||
phone = forms.CharField(required=False, max_length=13)
|
phone = forms.CharField(required=False, max_length=13)
|
||||||
captcha = ReCaptchaField()
|
# captcha = ReCaptchaField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.Profile
|
||||||
|
fields = ('first_name','last_name','initials','phone')
|
||||||
|
|
||||||
def clean_initials(self):
|
def clean_initials(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from django.core import serializers
|
|||||||
import simplejson
|
import simplejson
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
import datetime
|
import datetime
|
||||||
|
from registration.views import RegistrationView
|
||||||
|
|
||||||
from RIGS import models, forms
|
from RIGS import models, forms
|
||||||
|
|
||||||
@@ -33,6 +34,17 @@ def login(request, **kwargs):
|
|||||||
return login(request, authentication_form=forms.LoginForm)
|
return login(request, authentication_form=forms.LoginForm)
|
||||||
|
|
||||||
|
|
||||||
|
class ProfileRegistrationView(RegistrationView):
|
||||||
|
form_class = forms.ProfileRegistrationFormUniqueEmail
|
||||||
|
|
||||||
|
def register(self, request, **form):
|
||||||
|
model = models.Profile()
|
||||||
|
for (key,value) in form.items():
|
||||||
|
setattr(model, key, value)
|
||||||
|
model.set_password(form['password1'])
|
||||||
|
model.is_active = False
|
||||||
|
return model.save()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Called from a modal window (e.g. when an item is submitted to an event/invoice).
|
Called from a modal window (e.g. when an item is submitted to an event/invoice).
|
||||||
May optionally also include some javascript in a success message to cause a load of
|
May optionally also include some javascript in a success message to cause a load of
|
||||||
|
|||||||
Reference in New Issue
Block a user