django-messages-to-bootstrap-notify is a django reusable application to show django messages using bootstrap-notify
- Obtain your copy of source code from the git repository:
git clone https://github.com/DCOD-OpenSource/django-messages-to-bootstrap-notify.git. Or download the latest release from https://github.com/DCOD-OpenSource/django-messages-to-bootstrap-notify/tags/. - Run
python ./setup.py installfrom the repository source tree or the unpacked archive. Or use pip:pip install django-messages-to-bootstrap-notify.
Enable and configure Django Messages Framework.
Add "dm2bn" to settings.INSTALLED_APPS.
INSTALLED_APPS += (
"dm2bn",
)Load "dm2bn_tags" to your base template, load vendor static by including dm2bn/includes/dm2bn_static.html template, place bootstrap-notify settings in template by calling {% dm2bn_settings %} and call showMessages function.
For example:
{% load dm2bn_tags %}
{% include "dm2bn/includes/dm2bn_static.html" %}
{% dm2bn_settings %}
<script type="text/javascript">
$(function () {
// show messages
$.showMessages({{ messages|messages2json }});
});
</script>If you already use some part of vendor static, manual add missing requirements to you template.
Requirements:
For pretty looking error messages add "danger" to extra_tags in messages.error calls.
For example:
messages.error(request, "Something happened wrong :(", "danger")DM2BN_MESSAGES_CUMULATIVE_DELAY- Use cumulative delay to showing a message. Defaults to:
True. DM2BN_MESSAGE_DELAY- A message showing delay (in seconds). Defaults to:
3. DM2BN_MESSAGE_DELAY_FACTOR- A message showing delay factor (in chars per second). Defaults to:
8. DM2BN_MESSAGE_ICON- Message icon css classes. Defaults to:
"fa fa-exclamation-circle". DM2BN_MESSAGE_DEFAULT_SETTING- A message showing default settings. See documentation. Defaults to:
{
"allow_dismiss": True,
"placement": {
"from": "top",
"align": "right",
},
"delay": 3,
"mouse_over": "pause",
}django-messages-to-bootstrap-notify uses the MIT license. Please check the MIT-LICENSE file for more details.
django-messages-to-bootstrap-notify includes several third party libraries which come under their respective licenses. See their licensing information in the dm2bn/static/dm2rbn/vendor/ directory.
Project Website: https://github.com/DCOD-OpenSource/django-messages-to-bootstrap-notify/
Author: Alexei Andrushievich <[email protected]>
For other authors list see AUTHORS file.