I am trying to redirect to another page when http response is True I have added response['Location'] = 'login.html' but it's not working, I am getting a page with True written but not the login page. Can you help me I am new to django.
I have written this code
if user_obj:
response = HttpResponse(True)
response['Location'] = 'login.html'
return response
else:
return HttpResponse(False)
from django.urls import reverse
return HttpResponseRedirect(reverse('url_name'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With