I have a class based view that calls info() when a form is successfully posted. After reading the messaging framework document and commenting out the info call I'm sure that its the culprit of the 'Not all temporary messages could be stored' error.
I can't figure out what happens after the info call that causes the error in the post title, though.
clear() function. Show activity on this post. You need to iterate through the messages for your current set of messages as retrieved from the 'get_messages' method. You can use this code anywhere you want to clear the messages before setting new ones or where you want to simply clear all messages.
Import messages from django. contrib at the top of the file then go to the view function where you wish to add the message(s). In this case, it's a contact view that needs a Django success message and a Django error message. Add a success message just before the return redirect ("main:homepage") stating "Message sent."
Turns out the number of messages stored in the client-side cookie was maxed out. When the server tried to pack additional cookies into the client's cookie, it failed and raised the 'Not all temporary messages could be stored' value error.
I fixed this by making sure messages could be displayed in the browser by adding a
{% block messages %}
to the website's base template.
So this issue troubled me for a while. So in case you want your messages to be rendered on the browser, this case maybe when you are developing, debugging or want a sequential message log the you can update the django settings.py file
Change MESSAGE_STORAGE variable to:
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
this way it will hit the CookieStorage and then fallback to base storage.
Other alternative can be to store it in session
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With