Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Flash session persist #13

Open
jordyparker opened this issue May 7, 2021 · 1 comment
Open

Flash session persist #13

jordyparker opened this issue May 7, 2021 · 1 comment

Comments

@jordyparker
Copy link
Contributor

HI @zodman, I have been using this package for sometime now and +1. I get an error each time I share_flash to transmit it and it works fine but this error is persistent (like kind of remains in the session) and appears on all other requests.

I think setting request.session['share']['flash'] to {'success': False, 'error': False} after updating the variable props should work. Let me know you thoughs.

@girardinsamuel
Copy link
Contributor

girardinsamuel commented Feb 11, 2022

It should indeed be working yes !
That's what I have done in the default share method of the forked package of this repo I made. I am using it intensively in a project, and I need to maintain it and add features to it, so I made a fork.
Here are what you're talking about:
https://github.com/girardinsamuel/django-inertia/blob/v1.0.1/django_inertia/middleware.py#L61

We could also use the Django Messages module to have flash messages, but this is made for simple string message and it's not that easy to store JSON messages. (it requires to decode/encode them).

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

No branches or pull requests

2 participants