it/itf/itfprofiles/forms.py

14 lines
643 B
Python
Raw Normal View History

2012-02-02 10:43:34 +00:00
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