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.
精彩评论