Opened 14 years ago
Closed 14 years ago
#13695 closed (invalid)
Django Comments Loses Ajax Headers When Redirecting (request.is_ajax() === True --> request.is_ajax() === False)
Reported by: | jacobstr | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you redirect what was originally a request that:
request.is_ajax() === True
On the redirected page
request.is_ajax() === False
IMHO It should retain the Ajax headers. In my particular use case I'm submitting to django.contrib.comments via an ajax submission. I'm also providing the next
parameter, hoping that my custom view can respond differently depending on whether or not the original form posting was Ajax or not (i.e. the comment form gracefully degrades to a non-ajax version if your js is borken). Unfortunately, the request never shows up as an Ajax request.
Change History (3)
follow-up: 2 comment:1 by , 14 years ago
comment:2 by , 14 years ago
Replying to r1cky:
There is nothing django can do here. The initial and subsequent (after redirect) request are coming from the browser/client. The is_ajax method depends on an HTTP header (HTTP_X_REQUESTED_WITH) that apparently isn't getting set on the second request.
Yes. My instinct is that this was an oversight and not deliberate.
comment:3 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I'm with r1cky -- this is a problem on the client side, not the server side.
There is nothing django can do here. The initial and subsequent (after redirect) request are coming from the browser/client. The is_ajax method depends on an HTTP header (HTTP_X_REQUESTED_WITH) that apparently isn't getting set on the second request.