{ "info": { "author": "AliLozano", "author_email": "alilozanoc@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "Django Messages Extends\n==========================\n\n\n[![Build Status](https://travis-ci.org/mpasternak/django-messages-extends.svg?branch=master)](https://travis-ci.org/mpasternak/django-messages-extends)\n\n\nA Django app for extends Django's [messages framework](http://docs.djangoproject\n.com/en/dev/ref/contrib/messages/) (`django.contrib.messages`). framework by adding \"sticky\" and\n \"persistent\" backend message storages. This also supports the notion of sending\n persistent messages to other users in a machine-to-user process.\n\n\n## Storages ##\n\n### Sticky Storage ###\n\nA \"sticky\" message is a message where the user must hit the close button in order to get rid of\nit within that session.\n\n* For messages that are in some middleware or is only to the current request and don't need save it.\n* This is very similar to the default except that you explicitly must close the dialog to remove\nthe message.\n* This backend never save anything only simulate that do that.\n\n\n### Persistent Storage ###\n\nA \"persistent\" messages is a message where a message is retained across multiple sessions until\nthe user clicks the close button. The message is stored in the default_storage container\n(defaults to database).\n\n* Only for authenticated users, messages are stored in the database.\n* The messages has to be explicit read, and there are show while don't close it\n\nInstallation\n------------\n\nThis document assumes that you are familiar with Python and Django.\n\n1. [Download and unzip the app](https://github.com/AliLozano/django-messages-extends),\nor install using `pip`:\n\n $ pip install django-messages-extends\n\n2. Make sure `messages_extends` is on your `PYTHONPATH`.\n3. Add `messages_extends` to your `INSTALLED_APPS` setting.\n\n```python\nINSTALLED_APPS = (\n ...\n 'messages_extends',\n)\n```\n\n4. Make sure Django's `MessageMiddleware` is in your `MIDDLEWARE_CLASSES` setting (which is the\ncase by default):\n\n```python\nMIDDLEWARE_CLASSES = (\n ...\n 'django.contrib.messages.middleware.MessageMiddleware',\n)\n```\n\n5. Add the messages_extends URLs to your URL conf. For instance, in order to make messages\navailable under `http://domain.com/messages/`, add the following line to `urls.py`.\n\n```python\nurlpatterns = patterns('',\n (r'^messages/', include('messages_extends.urls')),\n ...\n)\n```\n\n6. In your settings, set the message [storage backend](http://docs.djangoproject.com/en/dev/ref/contrib/messages/#message-storage-backends)to `messages_extends.storages.FallbackStorage`:\n\n```python\nMESSAGE_STORAGE = 'messages_extends.storages.FallbackStorage'\n```\n\n7. Set up the database tables using\n\n\t $ manage.py syncdb\n\n8. If you want to use the bundled templates, add the `templates` directory to your\n`TEMPLATE_DIRS` setting:\n\n```python\nTEMPLATE_DIRS = (\n ...\n 'path/to/messages_extends/templates')\n)\n```\n\n\nUsing messages in views and templates\n-------------------------------------\n\n### Message levels ###\n\nDjango's messages framework provides a number of [message levels](http://docs.djangoproject.com/en/dev/ref/contrib/messages/#message-levels)\nfor various purposes such as success messages, warnings etc. This app provides constants with the\n same names, the difference being that messages with these levels are going to be persistent:\n\n```python\nfrom messages_extends import constants as constants_messages\n\n# default messages level\nconstants_messages.DEBUG = 10\nconstants_messages.INFO = 20\nconstants_messages.SUCCESS = 25\nconstants_messages.WARNING = 30\nconstants_messages.ERROR = 40\n\n# persistent messages level\nconstants_messages.DEBUG_PERSISTENT = 9\nconstants_messages.INFO_PERSISTENT = 19\nconstants_messages.SUCCESS_PERSISTENT = 24\nconstants_messages.WARNING_PERSISTENT = 29\nconstants_messages.ERROR_PERSISTENT = 39\n\n# sticky messages level\nconstants_messages.DEBUG_STICKY = 8\nconstants_messages.INFO_STICKY = 18\nconstants_messages.SUCCESS_STICKY = 23\nconstants_messages.WARNING_STICKY = 28\nconstants_messages.ERROR_STICKY = 38\n```\n\n### Adding a message ###\n\nSince the app is implemented as a [storage backend](http://docs.djangoproject.com/en/dev/ref/contrib/messages/#message-storage-backends)\nfor Django's [messages framework](http://docs.djangoproject.com/en/dev/ref/contrib/messages/), you\ncan still use the regular Django API to add a message:\n\n```python\nfrom django.contrib import messages\nmessages.add_message(request, messages.INFO, 'Hello world.')\n```\n\nOr use persistent messages with constants in messages_extends.constants\n\n```python\nfrom django.contrib import messages\nfrom messages_extends import constants as constants_messages\nmessages.add_message(request, constants_messages.WARNING_PERSISTENT, 'You are going to see this message until you mark it as read.')\n```\n\nOr via the shortcut method.\n\n```python\nmessages.add_persistant_error(request, 'Houston we have a problem..')\n```\n\nNote that this is only possible for logged-in users, so you are probably going to have make sure\nthat the current user is not anonymous using `request.user.is_authenticated()`. Adding a\npersistent message for anonymous users raises a `NotImplementedError`.\n\nAnd sticky messages:\n\n```python\nfrom django.contrib import messages\nfrom messages_extends import constants as constants_messages\nmessages.add_message(request, constants_messages.WARNING_STICKY, 'You will going to see this messages only in this request')\n```\n\nYou can also pass this function a `User` object if the message is supposed to be sent to a user\nother than the one who is currently authenticated. User Sally will see this message the next time\n she logs in:\n\n```python\nfrom django.contrib import messages\nfrom messages_extends import constants as constants_messages\nfrom django.contrib.auth.models import User\nsally = User.objects.get(username='Sally')\nmessages.add_message(request, constants_messages.INFO_PERSISTENT, \"Hola abc desde %s\" %request.user, user=sally)\n```\n\nTo persistent storages, there are other params like expires that is a datetime.\n\n### Displaying messages ###\n\nMessages can be displayed [as described in the Django manual](http://docs.djangoproject.com/en/dev/ref/contrib/messages/#displaying-messages).\nHowever, you are probably going to want to include links tags for closing each message (i.e.\nmarking it as read). In your template, use something like:\n\n```htmldjango\n{% for message in messages %}\n
\n {# close-href is used because href is used by bootstrap to closing other divs #}\n \u00d7\n {{ message }}\n
\n{% endfor %}\n```\n\nYou can also use the bundled templates instead. The following line replaces the code above. It\nallows the user to remove messages using [bootstrap styling](http://twitter.github.com/bootstrap/)\n(you need use bootstrap.css and boostrap.js)\n\n```htmldjango\n{% include \"messages_extends/includes/alerts_bootstrap.html\" %}\n```\n\nFor use Ajax to mark them as read you can add the following code that works with jquery:\n\n```javascript\n$(\"a.close[close-href]\").click(function (e) {\n e.preventDefault();\n $.post($(this).attr(\"close-href\"), \"\", function () {\n });\n}\n);\n```\n\nOr use:\n\n```htmldjango\n\n```\n\nDON'T FORGET: If you have CSRF enabled, you have to add csrf code by js, [see django Documentation](https://docs.djangoproject.com/en/dev/ref/csrf/#ajax)\n\nIf you don't want see close button in sticky alerts, you can use css for hide them:\n\n```css\n.alert.sticky .close{\n display: none;\n}\n```\n\n### Other Backends ###\n\nYou can use other backends, by default use:\n\n```python\nMESSAGES_STORAGES = ('messages_extends.storages.StickyStorage',\n 'messages_extends.storages.PersistentStorage',\n 'django.contrib.messages.storage.cookie.CookieStorage',\n 'django.contrib.messages.storage.session.SessionStorage'))\n```\n\nBut you can add or remove other backends in your settings in order that you need execute that,\nremember that session storagge save all messages, then you have to put it at final.\n\n### Remember ###\nRemember that this module is only for messages from application, to messages between users you can\nuse [postman](https://bitbucket.org/psam/django-postman) u other framework and to messages for\nactivity stream you can use [django-activity-stream](https://github.com/justquick/django-activity-stream)\n\n\n## License ##\n\nDjango Messages Extends is provided under [The MIT License (MIT)](http://opensource.org/licenses/MIT).\n\n\n## Credits ##\n\nDjango Messages Extends is a project by [Ali Lozano](mailto:alilozanoc@gmail.com). Additional credit\ngoes to:\n * [Steven Klass](sklass@pointcircle.com)\n\n\nInspired and based in [django-persistent-messages](https://github.com/samluescher/django-persistent-messages)\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AliLozano/django-messages-extends/", "keywords": "messages,django,persistent,sticky", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-messages-extends", "package_url": "https://pypi.org/project/django-messages-extends/", "platform": "", "project_url": "https://pypi.org/project/django-messages-extends/", "project_urls": { "Homepage": "https://github.com/AliLozano/django-messages-extends/" }, "release_url": "https://pypi.org/project/django-messages-extends/0.6.0/", "requires_dist": null, "requires_python": "", "summary": "A Django app for extends Django's messages framework, adds sticky messages and persistent messages", "version": "0.6.0" }, "last_serial": 3529899, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "9a95311ec994d952ff856a3d2fa3ced9", "sha256": "8961492bdbefed970502400936bb3a0d89bbcffc2e304f4ac0f5b7bf511462e8" }, "downloads": -1, "filename": "django-messages-extends-0.2.zip", "has_sig": false, "md5_digest": "9a95311ec994d952ff856a3d2fa3ced9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17307, "upload_time": "2014-05-07T00:12:23", "url": "https://files.pythonhosted.org/packages/6a/b4/7954a00268e642f2a9e9e34e4bcefbf9ccdf99b2d1ee52082e7bcb90128c/django-messages-extends-0.2.zip" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "5b8fe596fe65bc29db3306c7062a1504", "sha256": "5b7a4e0a58d3eccff644a00529e0e4af855485b64c929d5799bbe41e5f953274" }, "downloads": -1, "filename": "django-messages-extends-0.3.zip", "has_sig": false, "md5_digest": "5b8fe596fe65bc29db3306c7062a1504", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17302, "upload_time": "2014-05-08T06:07:51", "url": "https://files.pythonhosted.org/packages/80/4d/fc03f615ebfa8323d795fbda06f9d0b1e82b50394786255fa4b7f60b7507/django-messages-extends-0.3.zip" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "95527a968787c385a4cdfc19917cadde", "sha256": "da4bc06995e8fefbf1e7ef5e3a8cf541cff2f2c577d4f35e9c932c423bfcf01e" }, "downloads": -1, "filename": "django-messages-extends-0.3.1.zip", "has_sig": false, "md5_digest": "95527a968787c385a4cdfc19917cadde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17396, "upload_time": "2014-07-01T05:47:50", "url": "https://files.pythonhosted.org/packages/b0/42/1ff5a33addb949a84d6c90293993c48a9c8ae59404b40d5a7dc2788e2e3a/django-messages-extends-0.3.1.zip" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "86f00831e123183ccfc46d5d7e5e7155", "sha256": "88e0a07ad0563c7979d79dc6a54e7c84b821da2ef6be74cb7af9d905fe112dc4" }, "downloads": -1, "filename": "django-messages-extends-0.4.zip", "has_sig": false, "md5_digest": "86f00831e123183ccfc46d5d7e5e7155", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17543, "upload_time": "2015-01-23T16:50:00", "url": "https://files.pythonhosted.org/packages/ee/54/eaaad9811381963bbcdb8ae0c63a595fbb56c8d6021da0eea05bc4a60ac1/django-messages-extends-0.4.zip" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "0dde47dce83d2ec2e8ee236f404ffbea", "sha256": "9fc4171871727a78f0b691e44ae3a1a6f0d9cd1c42235d5aee1960f0bcb51f49" }, "downloads": -1, "filename": "django_messages_extends-0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0dde47dce83d2ec2e8ee236f404ffbea", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17976, "upload_time": "2016-01-31T03:56:23", "url": "https://files.pythonhosted.org/packages/ce/ae/09b335ad2e9840ffa53f4e6fa17532876e291a4863f60ddf6a67f803b328/django_messages_extends-0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c8e0b0976f30c13fc57b35660e0b556", "sha256": "76213ba664336135f7c297405537ba2e55a26636c78eaf4777cd8a316cbaa85b" }, "downloads": -1, "filename": "django-messages-extends-0.5.tar.gz", "has_sig": false, "md5_digest": "8c8e0b0976f30c13fc57b35660e0b556", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10826, "upload_time": "2016-01-31T03:56:28", "url": "https://files.pythonhosted.org/packages/51/a1/13af215477983a7244f36f18094bd9cb0f227edbbdfd097511359fae7f3f/django-messages-extends-0.5.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "f40e2e258cff978524f96d523cf9eb55", "sha256": "8662063c6f506419a8886070abe15ab32d346463ad6972490ec7a8743a4dd382" }, "downloads": -1, "filename": "django_messages_extends-0.6.0-py2-none-any.whl", "has_sig": false, "md5_digest": "f40e2e258cff978524f96d523cf9eb55", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 18442, "upload_time": "2018-01-28T21:46:22", "url": "https://files.pythonhosted.org/packages/fa/75/451e181bbe34168b6f54eb98f2677173c5b1c0fd9191cfbddc1a3b486bf4/django_messages_extends-0.6.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e9279a77de738568ea9ddf1e9dbd44cf", "sha256": "da14cc1b7b133ef11a6f8ff435b12146c55d932782112dfe7ff356c1ed25817d" }, "downloads": -1, "filename": "django_messages_extends-0.6.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e9279a77de738568ea9ddf1e9dbd44cf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18445, "upload_time": "2018-01-28T21:46:23", "url": "https://files.pythonhosted.org/packages/a8/5e/f0430c659171f4b8e07392a198aefa0cace3d50f534970d942b35ea3808f/django_messages_extends-0.6.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a59873ef3f9c47bf11dcf4bb29dd31c", "sha256": "42ad0e831d43807b893c5a6146cedb3ca4d02372ffae451dbd0ccfed0ae4594f" }, "downloads": -1, "filename": "django-messages-extends-0.6.0.tar.gz", "has_sig": false, "md5_digest": "1a59873ef3f9c47bf11dcf4bb29dd31c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14691, "upload_time": "2018-01-28T21:46:25", "url": "https://files.pythonhosted.org/packages/6b/57/405fd03df908af058ac68437ddf0c7ea29657d82847d8f52d6bcf689d107/django-messages-extends-0.6.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f40e2e258cff978524f96d523cf9eb55", "sha256": "8662063c6f506419a8886070abe15ab32d346463ad6972490ec7a8743a4dd382" }, "downloads": -1, "filename": "django_messages_extends-0.6.0-py2-none-any.whl", "has_sig": false, "md5_digest": "f40e2e258cff978524f96d523cf9eb55", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 18442, "upload_time": "2018-01-28T21:46:22", "url": "https://files.pythonhosted.org/packages/fa/75/451e181bbe34168b6f54eb98f2677173c5b1c0fd9191cfbddc1a3b486bf4/django_messages_extends-0.6.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e9279a77de738568ea9ddf1e9dbd44cf", "sha256": "da14cc1b7b133ef11a6f8ff435b12146c55d932782112dfe7ff356c1ed25817d" }, "downloads": -1, "filename": "django_messages_extends-0.6.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e9279a77de738568ea9ddf1e9dbd44cf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18445, "upload_time": "2018-01-28T21:46:23", "url": "https://files.pythonhosted.org/packages/a8/5e/f0430c659171f4b8e07392a198aefa0cace3d50f534970d942b35ea3808f/django_messages_extends-0.6.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a59873ef3f9c47bf11dcf4bb29dd31c", "sha256": "42ad0e831d43807b893c5a6146cedb3ca4d02372ffae451dbd0ccfed0ae4594f" }, "downloads": -1, "filename": "django-messages-extends-0.6.0.tar.gz", "has_sig": false, "md5_digest": "1a59873ef3f9c47bf11dcf4bb29dd31c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14691, "upload_time": "2018-01-28T21:46:25", "url": "https://files.pythonhosted.org/packages/6b/57/405fd03df908af058ac68437ddf0c7ea29657d82847d8f52d6bcf689d107/django-messages-extends-0.6.0.tar.gz" } ] }