view.py
When I fill the code in " view.py" for registration application the description below:
def register(request):
if request.method.POST =='POST':
username= request.POST.get('username')
email= request.POST.get('email')
password = request.POST.get('password')
if len(password)<3:
messages.error(request,"Password too short")
return redirect('register')
get_all_users_by_username= User.objects.filter(username=username)
if get_all_users_by_username:
messages.error(request,'Username is already taken ')
return redirect('register')
new_user = User.objects.create_user(usernam=username,email=email,password=password)
new_user.save()
return render(request,'cartes/registe.html',{})
I've got the message:
AttributeError at /register/
'str' object has no attribute 'POST'
I tried all the cases possible, but no real solution, even though I change my models many times depending on some who had some suggestions in that way.
Describe the bug
view.py When I fill the code in " view.py" for registration application the description below: def register(request): if request.method.POST =='POST': username= request.POST.get('username') email= request.POST.get('email') password = request.POST.get('password')
def loginpage(request): return render(request,'cates/login.html',{})
I've got the message: AttributeError at /register/ 'str' object has no attribute 'POST'
I tried all the cases possible, but no real solution, even though I change my models many times depending on some who had some suggestions in that way.
Steps to reproduce
No response
Model Used
No response
Expected Behavior
No response
Screenshots and logs
No response
Additional Information
No response