def save(self, commit=False): user = super(UserProfileForm, self).save(commit=False) user.save() profile = UserProfile(user=user) profile.forum_nickname = self.cleaned_data['forum_nickname'] if self.cleaned_data['exclude_from_nomination']: profile.exclude_from_nomination = True profile.save() return user
def save(self, commit=True): forum_nickname = self.cleaned_data['forum_nickname'] username = forum_nickname.replace(" ", "_") user = User(username=username) user.email = self.cleaned_data['email'] user.set_password(self.cleaned_data["password1"]) if commit: user.save() profile = UserProfile(user=user) profile.forum_nickname = forum_nickname profile.save() return user