Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

django.contrib.messages wrapper allowing pre-rendering of message dictionaries

Project description

A small Django package allowing a dictionary to be passed to contrib.messages. The dictionary is then pre-rendered and passed to the real contrib.message function.


A recent version of Django is required, but there are no third-party dependencies for this package.


Use your favorite Python installer to install it from PyPI:

$ pip install django-dictmessages

Or get the source from the application site:

$ hg clone
$ cd django-dictmessages
$ python install


Add 'dictmessages' to your INSTALLED_APPS setting like this:


Getting Started

Wherever you would normally make use of the django.contrib.messages API you can use this package instead:

# Before...
from django.contrib import messages

# After...
from dictmessages import messages

Since dictmessages is a simply a wrapper around the original functionality, you can continue to use it in the same way:

from dictmessages import messages

# This still works the same...
messages.success(request, 'Awesome! You totally nailed that, dude.')

But, if you’d like to something a little more fancy…:

from dictmessages import messages

message_dictionary = dict(
    object='Awesome!', activity='You totally nailed that, dude.')

messages.success(requestion, message_dictionary)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-dictmessages, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size django_dictmessages-1.0.0-py2.py3-none-any.whl (5.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-dictmessages-1.0.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page