2
It seems this a noted problem caused by caching in Django. Here is the comment made by one Django core developer:
“I don’t think Django can handle this problem automatically and correctly.
It is a very common pattern to loop over messages in the base template of a website. If we disable caching simply because messages might be displayed on a given page, we’re just killing the cache for most websites.”
The full ticket is here: https://code.djangoproject.com/ticket/13894
Source:stackexchange.com