Issue
I am trying to create a sign up page using django
after the user press the sign up button i want the page to redirect them to another page using this line of code
return redirect('congrat')
and also a function for "congrat" has already been created by me
def congrat(request):
return render(request,"login/congratulation.html")
also the url has been defined in the urls.py file
path("login/congrat",views.congrat,name = "congrat"),
but for some reason this is the output from the website after the button is clicked
I have consulted chatgpt which told me to check my urls.py and check if the function was defined which i have done and i cant seem to find an error there.
the code in the urls.py
urlpatterns = [path('',views.home,name = "home"),
path("sign_up_new/",views.sign_up_new,name = "sign_up_new"),
path("congrat/",views.congrat,name = "congrat"),
path("login/log_inn",views.log_inn,name = "log_inn"),
path("success/",views.success,name = "success"),]
Solution
Use as below.
return redirect('/login/congrat')
Answered By - Pycm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.