I have an app that adds a user to the system via auth.user and the app. On save I want to create the user and then get the auth.user.id and add that to a team_user.id.
I’ve been trying the code below and getting no where. Any suggestions as to what I’m doing wrong? Please advise.
if request.method == 'POST':
form = SimpleRegForm(request.POST)
if form.is_valid():
#form.save()
username = form.cleaned_data['username']
email = form.cleaned_data['email']
password = form.cleaned_data['password1']
user = User.objects.create_user(username, email, password)
new_teammember = form.save(commit=False)
new_teammember.team_user = request.user # I know this is not right.
new_teammember.save()
The issue is the request.user – It’s just user.