14 lines
643 B
Python
14 lines
643 B
Python
|
from django import forms
|
||
|
from registration.forms import RegistrationForm
|
||
|
from models import ItfProfile
|
||
|
from registration.models import RegistrationProfile
|
||
|
|
||
|
class ItfRegistrationForm(RegistrationForm):
|
||
|
subscribe = forms.BooleanField(help_text='Subscribe to newsletter?')
|
||
|
|
||
|
def save(self, profile_callback=None):
|
||
|
new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'], password=self.cleaned_data['password1'], email=self.cleaned_data['email'])
|
||
|
new_profile = ItfProfile(user=new_user, subscribed=self.cleaned_data['subscribe'])
|
||
|
new_profile.save()
|
||
|
return new_user
|