Skip to content
Advertisement

Registration form refreshes after submitting instead of sending post request in django

I’m trying to register a user but the page refreshes instead of submitting the data.

At the initial stage of my project, it was working properly but when I added some more models and form it’s not working and tried to register it stopped working.

and it also doesn’t throw any errors

views.py

JavaScript

models.py

JavaScript

forms.py

JavaScript

register.html

JavaScript

urls.py

JavaScript

I would also like to request some other suggestions on my code. Thank you.

Advertisement

Answer

Well, it’s a silly mistake. I think by mistake you put request.POST inplace of request.method.

In your register view change

JavaScript

to

JavaScript
Advertisement