it/itf/itfprofiles/forms.py
2012-02-02 16:13:34 +05:30

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