{ "info": { "author": "Miloslav Pojman", "author_email": "miloslav.pojman@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "Django-noticebox is a reusable Django application which provides functionality\nfor sending notices to site users. The notices can be displayed when user\nsigns in, sent by email or both.\n\n\nThis application is inspired by James Tauber's django-notification_ but\nit is designed to be much more lightweight.\n\n.. _django-notification: https://github.com/jtauber/django-notification\n\n\n============\nInstallation\n============\n\nThe django-noticebox application can be installed using standard setuptools\n`setup.py` script: ::\n\n $ python setup.py install\n\nInstallation using `easy_install` or `pip` is also possible. Alternatively\nyou can simply put the library anywhere to your `PYTHONPATH`.\n\n\n=====\nUsage\n=====\n\n\nNotice creation\n---------------\n\nIn the `noticebox.handlers` module are defined following callables for\na notice creation:\n\n `save_notice(users, preset=None, **kwargs)`\n\n Creates a notice model instance and saves it in the database.\n\n `mail_notice(users, preset=None, **kwargs)`\n\n Creates an email messages with the notice and sends it.\n\n `user_notice(users, preset=None, **kwargs)`\n\n Saves notice in the database and sends email. Effectively calls\n both `save_notice` and `mail_notice`.\n\nAll the handlers follow same signature. The first argument should be\na user instance, a user list or a user queryset. The subject and body strings\nshould be given as keyword arguments: ::\n\n user_notice(user, subject=\"Hello!\", body=\"Hello,\\nhow are you?\")\n\nThe `save_notice` and `mail_notice` handlers are actually class instances so\nthey can be customized if necessary.\n\n\nNotice templates\n................\n\nThe actual subjects and bodies are rendered using Django template\nsystem:\n\n `notices/default/email_subject.txt`\n\n Renders an email subject. By default returns given subject unchanged.\n This template can be customized if (for example) a common prefix should\n be added.\n\n `notices/default/email_body.txt`\n\n Renders an email body. By default returns given body unchanged.\n This template can be customized if (for example) a common footer should\n be added.\n\n `notices/default/web_subject.html`\n\n Renders a notice subject to be displayed on the website.\n By default returns the given subject HTML escaped.\n\n `notices/default/web_body.html`\n\n Renders a notice body to be displayed on the website.\n By default returns the given subject HTML escaped and new lines\n replaced by HTML paragraphs (using `linebreaks` template filter).\n\n\n\nPresets (alternative templates)\n...............................\n\nThe handlers do not actually require any specific keyword arguments\n(neither `subject` nor `body`). The given keyword arguments are simply passed\nto the template in the context.\n\nNon-default templates will be used if a `preset` argument is specified.\nFor example following call will render tamplates in the `notices/welcome/`\ndirectory with the `username` variable in the context: ::\n\n user_notice(user, preset=\"welcome\", username=\"alice\")\n\n\n\nNotice display (views)\n----------------------\n\nNotices in a database can be displayed on the web site when user logs in.\nTwo class based views are defined in the `noticebox.views` module:\n\n `NoticeListView`\n\n Displays paginated list of notices for the authenticated user.\n\n `NoticeDetailView`\n\n Display notice detail and marks it as read.\n\n\nBoth views are included in the `noticebox.urls` urlpatterns which means that if\nno customization is needed then they can be simply included in the url\nconfiguration: ::\n\n urlpatterns = patterns('',\n # ...\n (r'^notices/', include('noticebox.urls')),\n # ...\n )\n\nSimple templates for the views are present but it may be better to override\nthem for real projects.\n\nContext processor\n-----------------\n\nThe application provides a context processor which makes count of unread\nmessages available in the template: ::\n\n TEMPLATE_CONTEXT_PROCESSORS = (\n # ...\n 'noticebox.context_processors.notices',\n # ...\n )\n\nThe unread notice count is available in the `notice_unread_count`\nvariable. No database queries are executed until it is necessary.\n\n\n=======\nTesting\n=======\n\n\nAll tests can be discovered and run the Django test runner. For simplicity\nminimal Django settings are provided so all the tests can be run using\nDjango admin utility like this: ::\n\n django-admin.py test noticebox \\\n --settings=noticebox.tests.settings --pythonpath=$PWD", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/mila/django-noticebox/tree/master", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-noticebox", "package_url": "https://pypi.org/project/django-noticebox/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-noticebox/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/mila/django-noticebox/tree/master" }, "release_url": "https://pypi.org/project/django-noticebox/0.1/", "requires_dist": null, "requires_python": null, "summary": "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.", "version": "0.1" }, "last_serial": 790174, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f02b4b87bb2fd82f68d7b783ca7b013c", "sha256": "93eb91818eb549a8b72e4a060f343aff23290750bd88fce82bd9360ff026d5c6" }, "downloads": -1, "filename": "django-noticebox-0.1.tar.gz", "has_sig": false, "md5_digest": "f02b4b87bb2fd82f68d7b783ca7b013c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11806, "upload_time": "2012-09-27T15:54:56", "url": "https://files.pythonhosted.org/packages/8d/ed/825348aae5fcf1b7649c27e1baf9c3cdd9490d684c1a9b1c808de21b0701/django-noticebox-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f02b4b87bb2fd82f68d7b783ca7b013c", "sha256": "93eb91818eb549a8b72e4a060f343aff23290750bd88fce82bd9360ff026d5c6" }, "downloads": -1, "filename": "django-noticebox-0.1.tar.gz", "has_sig": false, "md5_digest": "f02b4b87bb2fd82f68d7b783ca7b013c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11806, "upload_time": "2012-09-27T15:54:56", "url": "https://files.pythonhosted.org/packages/8d/ed/825348aae5fcf1b7649c27e1baf9c3cdd9490d684c1a9b1c808de21b0701/django-noticebox-0.1.tar.gz" } ] }