Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6234079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:25:04+00:00 2026-05-24T10:25:04+00:00

I have a team registration app. A user signs up to be a part

  • 0

I have a team registration app. A user signs up to be a part of the team. When they do so, the view adds a team member and adds the user into the auth db.

However, when the team model returns invalid data, the user.save() method is adding the username, password and email.

So, when a user corrects the team registration, and clicks submit, they are now told that the username is taken.

What I want to have happen is the username etc is added AFTER the teammember has been validated.

Any suggestions?

Here’s the view:

def register(request, **kwargs):
    if request.method == 'POST':
        form = SimpleRegForm(request.POST)
        if form.is_valid():
            username = form.cleaned_data['username']
            email = form.cleaned_data['email']
            password = form.cleaned_data['password1']
            user = User.objects.create_user(username, email, password)
            user.save()
            form.save()

            # Send an email to the admin letting them know that a person registered
            subject = render_to_string('teamregistration/email_subject.txt')
            message = render_to_string('teamregistration/email_body.txt',
                                       {'first_name':form.cleaned_data['first_name'], 'last_name':form.cleaned_data['last_name'], 'tbi_region':form.cleaned_data['tbi_region']})
            recipients = ['XXXXXX@XXXXXX.XXX', 'XXXXXX@XXXXXX.XXX']
            send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipients)

            return HttpResponseRedirect('/tbi-team-register/registration-submitted/')
    else:
        form = SimpleRegForm()

    return render_to_response('teamregistration/form.html', {'form':form}, context_instance=RequestContext(request))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:25:06+00:00Added an answer on May 24, 2026 at 10:25 am

    All you have to do is remove the user.save().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Team I'm creating an iphone application using Sencha Touch. I have registration form ,
I have a team member who inadvertently pushed over 150 of his local branches
I have a web-app where when the user submits a request, we send a
I have a team of junior developers and they want to have better understanding
I'm currently setting up CI for my project and have team city configure and
I am interested in the following scenario specifically. Suppose you have team that writes
my team have built many tools for our project using win forms and Visual
My team have 3 or 5 person.And we are working locally. and we decided
We have a team that built an agent in Mono using MonoDevelop on Mac
I have installed team foundation server 2012 express and am wanting to connect through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.