开发者

How should redirects be handled with django-pjax?

I'm using django-pjax, and I'm not sure how I should be redirecting from within a view that could also return a pjax response.

If I use the redirect shortcut, I get:

开发者_StackOverflowAttributeError: 'HttpResponseRedirect' object has no attribute 'template_name'

Probably because django-pjax requres a TemplateResponse object, not a HttpResponse object. But since TemplateResponse objects don't handle redirects, I'm not sure what to do.

Any guidance is appreciated!


At your front-end try this type of redirecting:

$.pjax({url: $('.logo').attr('href'), container: '#w0'});

Replace $('.logo').attr('href') to your url and #w0 to your container ID.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜