djangoflash.middleware — Django-Flash middleware

This module provides the FlashMiddleware class, which manages the flash whenever a HTTP request hits the server.

To plug this middleware to your Django project, edit your project’s settings.py file as follows:

MIDDLEWARE_CLASSES = (
    'djangoflash.middleware.FlashMiddleware',
)

FlashMiddleware Class

class djangoflash.middleware.FlashMiddleware

Bases: object

This middleware uses the flash storage backend specified by the project’s settings.py file in order to store and retrieve djangoflash.models.FlashScope objects, being also responsible for expiring old flash-scoped objects.

Note

This class is designed to be used by the Django framework itself.

process_request(request)

This method is called by the Django framework when a request hits the server.

process_response(request, response)

This method is called by the Django framework when a response is sent back to the user.