[Answered ]-Why doesn't Django allow redirect with context

2👍

This is not in any way a limitation of Django, and you don’t seem to have thought through how this would even work.

A redirect is a simple HTTP response that tells your browser to go and request another page. How would Django, or any framework, pass a context through that redirect? Where would it go? And the receiving URL would have its own view, which would generate its own context – what would it do with the “redirect” context? How would it know?

But in any case I don’t understand why you would want to redirect back to the same page on an error. Simply redisplay it. The redirect-after-POST principle is for successful posts, not unsuccessful ones.

Leave a comment