This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description

Django-noticebox is a reusable Django application which provides functionality for sending notices to site users. The notices can be displayed when user signs in, sent by email or both.

This application is inspired by James Tauber’s django-notification but it is designed to be much more lightweight.


The django-noticebox application can be installed using standard setuptools script:

$ python install

Installation using easy_install or pip is also possible. Alternatively you can simply put the library anywhere to your PYTHONPATH.


Notice creation

In the noticebox.handlers module are defined following callables for a notice creation:

save_notice(users, preset=None, **kwargs)

Creates a notice model instance and saves it in the database.

mail_notice(users, preset=None, **kwargs)

Creates an email messages with the notice and sends it.

user_notice(users, preset=None, **kwargs)

Saves notice in the database and sends email. Effectively calls both save_notice and mail_notice.

All the handlers follow same signature. The first argument should be a user instance, a user list or a user queryset. The subject and body strings should be given as keyword arguments:

user_notice(user, subject="Hello!", body="Hello,\nhow are you?")

The save_notice and mail_notice handlers are actually class instances so they can be customized if necessary.

Notice templates

The actual subjects and bodies are rendered using Django template system:


Renders an email subject. By default returns given subject unchanged. This template can be customized if (for example) a common prefix should be added.


Renders an email body. By default returns given body unchanged. This template can be customized if (for example) a common footer should be added.


Renders a notice subject to be displayed on the website. By default returns the given subject HTML escaped.


Renders a notice body to be displayed on the website. By default returns the given subject HTML escaped and new lines replaced by HTML paragraphs (using linebreaks template filter).

Presets (alternative templates)

The handlers do not actually require any specific keyword arguments (neither subject nor body). The given keyword arguments are simply passed to the template in the context.

Non-default templates will be used if a preset argument is specified. For example following call will render tamplates in the notices/welcome/ directory with the username variable in the context:

user_notice(user, preset="welcome", username="alice")

Notice display (views)

Notices in a database can be displayed on the web site when user logs in. Two class based views are defined in the noticebox.views module:


Displays paginated list of notices for the authenticated user.


Display notice detail and marks it as read.

Both views are included in the noticebox.urls urlpatterns which means that if no customization is needed then they can be simply included in the url configuration:

urlpatterns = patterns('',
    # ...
    (r'^notices/', include('noticebox.urls')),
    # ...

Simple templates for the views are present but it may be better to override them for real projects.

Context processor

The application provides a context processor which makes count of unread messages available in the template:

    # ...
    # ...

The unread notice count is available in the notice_unread_count variable. No database queries are executed until it is necessary.


All tests can be discovered and run the Django test runner. For simplicity minimal Django settings are provided so all the tests can be run using Django admin utility like this: test noticebox \
    --settings=noticebox.tests.settings --pythonpath=$PWD
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-noticebox-0.1.tar.gz (11.8 kB) Copy SHA256 Checksum SHA256 Source Sep 27, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting