Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

pjax call breaks when returning a HttpResponseRedirect, so we explicitly check if the context_data attribute exists #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions djpjax.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ def _view(request, *args, **kwargs):
# if not hasattr(resp, "is_rendered"):
# warnings.warn("@pjax used with non-template-response view")
# return resp
if request.META.get('HTTP_X_PJAX', False):
resp.context_data[context_var] = pjax_parent
elif parent:
resp.context_data[context_var] = parent
if hasattr(resp, 'context_data'):
if request.META.get('HTTP_X_PJAX', False):
resp.context_data[context_var] = pjax_parent
elif parent:
resp.context_data[context_var] = parent
return resp
return _view
return pjaxtend_decorator
Expand Down