Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:philomat/django-persistent-messages

  • Loading branch information...
commit 12a0e1fef969ca7436756103dd61e157acaa5a13 2 parents a5eb788 + af89b2f
Samuel Luescher samluescher authored
Showing with 42 additions and 7 deletions.
  1. +2 −2 README.md
  2. +11 −5 persistent_messages/models.py
  3. +29 −0 setup.py
4 README.md
View
@@ -3,7 +3,7 @@ Django Persistent Messages
A Django app for unified and persistent user messages/notifications, built on top of Django's [messages framework](http://docs.djangoproject.com/en/dev/ref/contrib/messages/) (`django.contrib.messages`).
-This app provides support for messages that are supposed to be persistent, that is, they outlast a browser session and will be displayed as “sticky” notes to the user, until they are actively marked as read. Once read, messages are still listed in the message inbox for each user.
+This app provides support for messages that are supposed to be persistent, that is, they outlast a browser session and will be displayed as “sticky” notes to the user, until they are actively marked as read. Once read, messages are still listed in the message inbox for each user. In short: While `django.contrib.messages` makes sure that messages you create are displayed to the user, this app makes sure that they actually get noticed.
* For authenticated users, messages are stored in the database. They can be temporary just like regular messages, or persistent as described above.
* For anonymous users, the default cookie/session-based approach is used, i.e. there is no database access for storing messages.
@@ -15,7 +15,7 @@ Installation
This document assumes that you are familiar with Python and Django.
-1. [Download and unzip the app](http://github.com/philomat/django-persistent-messages/), or install using `git`:
+1. [Download and unzip the app](http://github.com/philomat/django-persistent-messages/), or clone the source using `git`:
$ git clone git://github.com/philomat/django-persistent-messages.git
16 persistent_messages/models.py
View
@@ -69,12 +69,18 @@ def _get_tags(self):
label_tag = force_unicode(LEVEL_TAGS.get(self.level, ''),
strings_only=True)
extra_tags = force_unicode(self.extra_tags, strings_only=True)
+
+ if (self.read):
+ read_tag = "read"
+ else:
+ read_tag = "unread"
+
if extra_tags and label_tag:
- return u' '.join([extra_tags, label_tag])
+ return u' '.join([extra_tags, label_tag, read_tag])
elif extra_tags:
- return extra_tags
+ return u' '.join([extra_tags, read_tag])
elif label_tag:
- return label_tag
- return ''
+ return u' '.join([label_tag, read_tag])
+ return read_tag
tags = property(_get_tags)
-
+
29 setup.py
View
@@ -0,0 +1,29 @@
+import os
+from distutils.core import setup
+
+def read(fname):
+ return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+setup(
+ name='django-persistent-messages',
+ version='0.1',
+ description='A Django app for unified and persistent user messages/notifications, built on top of Django\'s messages framework',
+ long_description=read('README.md'),
+ author='philomat',
+ license='BSD',
+ url='http://github.com/philomat/django-persistent-messages',
+ keywords = ['messages', 'django', 'persistent',],
+ packages=[
+ 'persistent_messages',
+ ],
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Framework :: Django',
+ ],
+ zip_safe=False,
+)
Please sign in to comment.
Something went wrong with that request. Please try again.