This module provides the context processor that exposes djangoflash.models.FlashScope objects to view templates.
To plug this context processor to your Django project, edit your project’s settings.py file as follows:
TEMPLATE_CONTEXT_PROCESSORS = (
'djangoflash.context_processors.flash',
)
Doing this, the view templates will be able to access the flash contents using the flash context variable.
Warning
Your views should use the RequestContext class to render the templates, otherwise the flash variable (along with all other variables provided by other context processors) won’t be available to them. Please read the Django docs for further instructions.
This context processor gets the FlashScope object from the current request and adds it to the template context:
<html>
<head></head>
<body>
request.flash['message'] = {{ flash.message }}
</body>
</html>
See also