Example #1
0
 def save(self, commit=True):
     user = super(UserCreateForm, self).save(commit=False)
     user.email = self.cleaned_data["email"]
     if commit:
         user.save()
         member = Member()
         member.user = user
         member.save()
     return user
Example #2
0
    def save(self, commit=True):
        # Create user from the forms datas and set the email field manually, but DON'T commit
        user = super(user_create_form, self).save(commit=False)
        user.email = self.cleaned_data["email"]

        # When we want to commit (everytimes),
        # save the user, create, link and saveth member.
        if commit:
            user.save()
            member = Member()
            member.user = user
            member.save()
        return user