Monday, December 24, 2018

Re: HttpResponseRedirect failed in django 2.1

Try return HttpResponseRedirect("/login/") instead of return HttpResponseRedirect("login")

On Monday, December 24, 2018 at 7:35:13 PM UTC+5:30, ali reza wrote:

Greetings!


Question:
I wrote a view (def register(request)) to check if DB is empty, user can to create a new SuperUser. When DB is empty, "register" view works fine on GET request. but when user is submitting her/his info (via POST request), then he/she must be redirected to "login" url (mean: now user should enter USER and PASS in login page). but a "login" is added after "register/" in browser-address-bar.
note: inserting data (superuser) to DB works fine. but redirect doesn't work.


uploaded code:
https://pastebin.com/fLibTNP9


uploaded error:

https://community.simpleisbetterthancomplex.com/uploads/default/original/1X/3f87e25453576231d7e4f07a8c651da65cae8cb1.png


why "login" is appended to address-bar after "register/" !?
where is the problem !?


thanks in advance

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7f6a2096-8d2f-45ee-988b-75eda241320d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment