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.
Dependencies
A recent version of Django is required, but there are no third-party dependencies for this package.
Installation
Use your favorite Python installer to install it from PyPI:
$ pip install django-dictmessages
Or get the source from the application site:
$ hg clone https://bitbucket.org/mhurt/django-dictmessages $ cd django-dictmessages $ python setup.py install
Configuration
Add 'dictmessages' to your INSTALLED_APPS setting like this:
INSTALLED_APPS = {
...
'dictmessages',
}
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-dictmessages-1.0.0.tar.gz.
File metadata
- Download URL: django-dictmessages-1.0.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dae206c73cf4a24c808ef02ef787f1d9b7be99f1361b8a9e1bd2e10346b88646
|
|
| MD5 |
9bdaf80f9b422cbf81e906a24be775f6
|
|
| BLAKE2b-256 |
c57e987cc344f7b8357c1cf365ba56d8c0213c47521ac48c0d4e1b0e6ee475b5
|
File details
Details for the file django_dictmessages-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: django_dictmessages-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8764b3695de3ed6d57a29736bae337978f1eda85ee7a489d65a53848a172bce
|
|
| MD5 |
9fb3eb150f92f58e5ce6944a25527515
|
|
| BLAKE2b-256 |
0f90e8066c0f212175868d8c69ab7088ab7138269e7c4eeb287e3c57903ad0ac
|