Changes between Version 28 and Version 29 of SessionMessages


Ignore:
Timestamp:
Oct 13, 2009, 6:29:58 PM (15 years ago)
Author:
Tobias McNulty
Comment:

remove API for django-notify

Legend:

Unmodified
Added
Removed
Modified
  • SessionMessages

    v28 v29  
    9898 * ERROR: An action was '''not''' successful or some other failure occurred
    9999
    100 === django-notify ===
    101 django-notify is the current front-runner in terms of technical features so a sampling of the potential API is included below.  Feel free to include the API(s) of other solutions as well for comparison.  It is understood that, should django-notify be chosen, this may (and probably will) change prior to inclusion in the core.
    102 
    103 Add the middleware to your MIDDLEWARE_CLASSES setting (after !SessionMiddleware):
    104 {{{
    105     'django_notify.middleware.NotificationsMiddleware',
    106 }}}
    107 
    108 Add the context processor into your TEMPLATE_CONTEXT_PROCESSORS setting:
    109 {{{
    110     'django_notify.context_processors.notifications',
    111 }}}
    112 
    113 Add a temporary notification message like this:
    114 {{{
    115     request.notifications.add('Hello world.')
    116     # You can optionally provide a string containing tags (which is usually represented as HTML classes for the message).
    117     request.notifications.add('Your rating is over 9000!', 'error')
    118 }}}
    119 
    120 Use notifications in your template:
    121 {{{
    122 {% if notifications %}
    123 <ul class="notifications">
    124         {% for message in notifications %}
    125         <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
    126         {% endfor %}
    127 </ul>
    128 {% endif %}
    129 }}}
    130 
    131100== TODO Once a Solution is Chosen ==
    132101
Back to Top