django-email-notification /

Filename Size Date modified Message
82 B
1.3 KB
2.3 KB


Notifications are short emails sent to users by Facebook or Twitter to inform users of some changes.

django-email-notification allow you to send short email notifications to django registered users and also to users you only know the email about what is new or changed.


NOTIFICATION_FROM_EMAIL = ''  # sender email, typically
NOTIFICATION_FROM_NAME = ''   # sender name
NOTIFICATION_UNSUBSCRIBE_REDIRECT = '/you-unsubscribed/'  # possible page redirection after unsubscription
NOTIFICATION_REGISTRATION_MESSAGE_TAG = 'notification'  # allow filtering notification messages

# Description of linkable objects.
    {   'name': 'products',                                     # reference name, used in forms and templates
        'description': u"New products",                         # Human readable description
        'long_description': u"Last products added to our site", # Long description
        'class': 'project.application.models.Product',          # path to the class model
        'title_attr': 'product_description',                    # Model instance field to display in form, can be a callable
        'order_by': '-creation_date',                           # order to sort Model instances in form and email template
        'manager': '',                                          # manager to use if so

Email template:

In template, linked objects can be processed this way by example:

{% if object_types.OBJECT_NAME.instances %}
    <ul><li>{{ object_types.OBJECT_NAME.long_description }}
    <ul>{% for instance in object_types.OBJECT_NAME.instances %}
    <li><a href="http://{{ site }}{{ instance.get_absolute_url }}">{{ instance.get_title }}</a></li>
    {% endfor %}</ul>
{% endif %}

Messages sent through the django messages framework filtered like this:

{% if messages %}
    {% for message in messages %}
        {% if 'notification' in message.tags %}
            <span class="email-registration-message lvl-{{ message.level }}">{{ message }}</span>
        {% endif %}
    {% endfor %}
{% endif %}