messages.storage.base.BaseStorage

class storage.base.BaseStorage To write your own storage class, subclass the BaseStorage class in django.contrib.messages.storage.base and implement the _get and _store methods.

messages.storage.base.Message

class storage.base.Message When you loop over the list of messages in a template, what you get are instances of the Message class. It’s quite a simple object, with only a few attributes: message: The actual text of the message. level: An integer describing the type of the message (see the message levels section above). tags: A string combining all the message’s tags (extra_tags and level_tag) separated by spaces. extra_tags: A string containing custom tags for this message, separated by

messages.storage.cookie.CookieStorage

class storage.cookie.CookieStorage This class stores the message data in a cookie (signed with a secret hash to prevent manipulation) to persist notifications across requests. Old messages are dropped if the cookie data size would exceed 2048 bytes.

messages.storage.fallback.FallbackStorage

class storage.fallback.FallbackStorage This class first uses CookieStorage, and falls back to using SessionStorage for the messages that could not fit in a single cookie. It also requires Django’s contrib.sessions application. This behavior avoids writing to the session whenever possible. It should provide the best performance in the general case. FallbackStorage is the default storage class. If it isn’t suitable to your needs, you can select another storage class by setting MESSAGE_STORAGE

messages.storage.session.SessionStorage

class storage.session.SessionStorage This class stores all messages inside of the request’s session. Therefore it requires Django’s contrib.sessions application.

messages.views.SuccessMessageMixin

class views.SuccessMessageMixin Adds a success message attribute to FormView based classes get_success_message(cleaned_data) cleaned_data is the cleaned data from the form which is used for string formatting Example views.py: from django.contrib.messages.views import SuccessMessageMixin from django.views.generic.edit import CreateView from myapp.models import Author class AuthorCreate(SuccessMessageMixin, CreateView): model = Author success_url = '/success/' success_messag

messages.views.SuccessMessageMixin.get_success_message()

get_success_message(cleaned_data) cleaned_data is the cleaned data from the form which is used for string formatting

middleware.cache.FetchFromCacheMiddleware

class FetchFromCacheMiddleware [source] Enable the site-wide cache. If these are enabled, each Django-powered page will be cached for as long as the CACHE_MIDDLEWARE_SECONDS setting defines. See the cache documentation.

middleware.cache.UpdateCacheMiddleware

class UpdateCacheMiddleware [source]

middleware.clickjacking.XFrameOptionsMiddleware

class XFrameOptionsMiddleware [source] Simple clickjacking protection via the X-Frame-Options header.