Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages returned by django are not seen by user #4

Open
bblough opened this issue Jun 8, 2016 · 0 comments
Open

Messages returned by django are not seen by user #4

bblough opened this issue Jun 8, 2016 · 0 comments

Comments

@bblough
Copy link

bblough commented Jun 8, 2016

Since the response is fetched via XHR and discarded after the upload is successful, any flash messages set by django on a successful upload are never seen by the user.

I think fixing this would require a bunch of stuff that would be complicated and unnecessary. However, I thought it might be helpful to document the behavior and a possible workaround, in case others experience the issue.

To workaround the issue, pass an empty messages list to the view renderer -
status = 200
return render(request, self.template_name, {'messages': []}, status=status)

The discarded response will contain the empty message list, while the messages in message queue will be untouched. Then, after the redirect, any messages in the message queue will be displayed normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant