Dec-24-2021, 03:08 PM
Hi,
I came across this code and it is registering the user but without having the user part of staff members. How to make that happened?
I came across this code and it is registering the user but without having the user part of staff members. How to make that happened?
def register_user(request):
if request.method == "POST":
form = UserCreationForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data['username']
password = form.cleaned_data['password1']
user = authenticate(username=username, password= password)
login(request,user)
messages.success(request,"Registration successful")
return redirect('store')
else:
form = UserCreationForm()
return render(request, 'authenticate/register_user.html', {'form':form,})
