{ "info": { "author": "Atrox", "author_email": "mail@atrox.me", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Sweetify - SweetAlert for Django\n\n[![Build Status](https://img.shields.io/travis/Atrox/sweetify-django.svg?style=flat-square)](https://travis-ci.org/Atrox/sweetify-django)\n[![Latest Version](https://img.shields.io/pypi/v/sweetify.svg?style=flat-square)](https://pypi.python.org/pypi/sweetify)\n[![Coverage Status](https://img.shields.io/coveralls/Atrox/sweetify-django.svg?style=flat-square)](https://coveralls.io/r/Atrox/sweetify-django)\n\n**Sweetify** allows you to use [SweetAlert](http://t4t5.github.io/sweetalert/) or [SweetAlert2](https://github.com/limonte/sweetalert2) for your temporary messages.\n_See the examples below, to see how to use this library_\n\n## Installation\n**Note: This package does not provide the client-side files of SweetAlert. You have to provide them yourself.**\n\nInstall the latest version with `pip`:\n\n```bash\npip install --upgrade sweetify\n```\n\nThen you have to add `sweetify` to your django apps:\n```python\nINSTALLED_APPS = [\n ...\n 'sweetify'\n]\n```\n\nNext up you have to specify, in your settings, which library you are using (SweetAlert or SweetAlert2):\n```python\n# possible options: 'sweetalert', 'sweetalert2' - default is 'sweetalert2'\nSWEETIFY_SWEETALERT_LIBRARY = 'sweetalert2'\n```\n\nNext add the following lines to the bottom of your layout/base template:\n```html\n...\n\n{% load sweetify %}\n{% sweetify %}\n\n\n\n```\n\n## Usage\nYou can now easily create alerts in your views with any of the following methods provided by **Sweetify**:\n```python\nimport sweetify\n\n# Base method with no type specified\nsweetify.sweetalert(self.request, 'Westworld is awesome', text='Really... if you have the chance - watch it!' persistent='I agree!')\n\n# Additional methods with the type already defined\nsweetify.info(self.request, 'Message sent', button='Ok', timer=3000)\nsweetify.success(self.request, 'You successfully changed your password')\nsweetify.error(self.request, 'Some error happened here - reload the site', persistent=':(')\nsweetify.warning(self.request, 'This is a warning... I guess')\n```\n\n## Example Usage\n```python\nimport sweetify\n\ndef test_view(request):\n sweetify.success(request, 'You did it', text='Good job! You successfully showed a SweetAlert message', persistent='Hell yeah')\n return redirect('/')\n```\n\n## Replacement for SuccessMessageMixin\nSweetify includes a drop-in replacement for `SuccessMessageMixin`.\nJust replace the Django mixin with Sweetify's `SweetifySuccessMixin` and you are good to go.\n\n```python\nfrom sweetify.views import SweetifySuccessMixin\n\nclass TestUpdateView(SweetifySuccessMixin, UpdateView):\n model = TestModel\n fields = ['text']\n success_message = 'TestModel successfully updated!'\n```\n\n## Options\n**By default, all alerts will dismiss after a sensible default number of seconds.**\n\nDefault options set by **Sweetify**:\n```python\nsweetify.DEFAULT_OPTS = {\n 'showConfirmButton': False,\n 'timer': 2500,\n 'allowOutsideClick': True,\n 'confirmButtonText': 'OK',\n}\n```\n\nThe following special options provided by **Sweetify** are available:\n```python\n# Shows the alert with a button, but will still close automatically\nsweetify.sweetalert(self.request, 'Title', button=True)\nsweetify.sweetalert(self.request, 'Title', button='Awesome!') # Custom text for the button\n\n# Shows the alert with a button and only closes if the button is pressed\nsweetify.sweetalert(self.request, 'Title', persistent=True)\nsweetify.sweetalert(self.request, 'Title', persistent='Awesome!') # Custom text for the button\n```\n\nYou also can use any other available option that [SweetAlert accepts](http://t4t5.github.io/sweetalert/):\n```python\nsweetify.info(self.request, 'Sweet!', text='Here is a custom image', imageUrl='images/thumbs-up.jpg', timer=5000)\n```\n\n\n\n## Development\nUse the `Makefile`to execute common tasks:\n\n- Install dependencies\n```shell\n$ make install\n```\n\n- Run all tests\n```shell\n$ make test\n```\n\n## Contributing\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/atrox/sweetify-django/issues)\n- Fix bugs and [submit pull requests](https://github.com/atrox/sweetify-django/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Atrox/sweetify-django", "keywords": "sweetalert,django,messages", "license": "BSD-3-Clause", "maintainer": "Atrox", "maintainer_email": "mail@atrox.me", "name": "sweetify", "package_url": "https://pypi.org/project/sweetify/", "platform": "", "project_url": "https://pypi.org/project/sweetify/", "project_urls": { "Homepage": "https://github.com/Atrox/sweetify-django", "Repository": "https://github.com/Atrox/sweetify-django" }, "release_url": "https://pypi.org/project/sweetify/2.0.0/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "SweetAlert integration for Django", "version": "2.0.0" }, "last_serial": 5173207, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7aa6a347f39243ca291506dbc77e3120", "sha256": "90dc047e85ea5ec0c031e80492343afd1fd0317ff45e7bc13d725768553bf2f0" }, "downloads": -1, "filename": "sweetify-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7aa6a347f39243ca291506dbc77e3120", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9285, "upload_time": "2017-09-06T18:50:22", "url": "https://files.pythonhosted.org/packages/a1/db/d2875ead7e3d28054ca64e6d79bebb585779dbcaec0df9a4e6b5a995a1c9/sweetify-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "21cf3a1f0a771f15dbfec466f5694c83", "sha256": "0dfb471bdee8237ebfd80220c396039ff3af4bcb55c49b11c5178dabaabe1fa7" }, "downloads": -1, "filename": "sweetify-1.0.0.tar.gz", "has_sig": false, "md5_digest": "21cf3a1f0a771f15dbfec466f5694c83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6773, "upload_time": "2017-09-06T18:50:24", "url": "https://files.pythonhosted.org/packages/5f/4e/dd2fe5b6d742e05dbb88fd6688e91c9743ce751d080e1a7ce7f7f6042fc1/sweetify-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ad1bc600f07fcf4b1ec063c8dcb82d3c", "sha256": "2aa758b04558d406da751988a2578de58a30b2b6e82c5bd97d64b1ebc3a2cd15" }, "downloads": -1, "filename": "sweetify-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad1bc600f07fcf4b1ec063c8dcb82d3c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9330, "upload_time": "2017-09-06T18:57:50", "url": "https://files.pythonhosted.org/packages/dc/d9/24d73e79a84d3a9f536f2e4cd81fa89b7ec23047f4c11a7c8cf2b34c2a91/sweetify-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2e3fb576dec5839798ad6c0e76aa2cb2", "sha256": "16e8ba92bed0dc5ff6c06d36ee4bca21115291edf1ddb5f5fc16b63985ae322a" }, "downloads": -1, "filename": "sweetify-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2e3fb576dec5839798ad6c0e76aa2cb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7532, "upload_time": "2017-09-06T18:57:52", "url": "https://files.pythonhosted.org/packages/f5/68/85551330b5cfc6d1c7a7f666a3ee978a84c458146268f37ef11d2bab1824/sweetify-1.0.1.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "3d985c2208296b5f24f03e698b591673", "sha256": "b9896107082d05bcbbecbc4fe7339e4221c333566e71c8421d04a687287048f1" }, "downloads": -1, "filename": "sweetify-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3d985c2208296b5f24f03e698b591673", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9326, "upload_time": "2017-12-04T15:17:45", "url": "https://files.pythonhosted.org/packages/94/a1/f5fc1a2c49377dfe62ab83cc861fb0c0fe1b000c4a3686af4bc8cccfe43b/sweetify-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a3e05d016bc9448941082d84aadc77d", "sha256": "0d48e8e1b76e7b8dd506d24bf79eb94bb9a9d9ec6e320c89ac8dfa289226034c" }, "downloads": -1, "filename": "sweetify-1.0.3.tar.gz", "has_sig": false, "md5_digest": "5a3e05d016bc9448941082d84aadc77d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7490, "upload_time": "2017-12-04T15:17:47", "url": "https://files.pythonhosted.org/packages/93/3c/4bbcad79b419da90683dccbe14a6f0a62d1cdb8935f1694475ac225604ba/sweetify-1.0.3.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "9a7d3f0d045fec876ea17105a0842920", "sha256": "c57c1676eeac680a9acd645af1750edbe0d2fbf0128b276634e74ea890cd2979" }, "downloads": -1, "filename": "sweetify-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9a7d3f0d045fec876ea17105a0842920", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 6494, "upload_time": "2019-04-22T14:46:56", "url": "https://files.pythonhosted.org/packages/eb/57/df07cc01dbc883d4a554170d9f2f2a18a6dc93a26ab3104fe7f16797a798/sweetify-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3748a5dada961498010dc209d5a93e09", "sha256": "ae776b3f956f4a9af7236a613ba77b61002f690e7a60c0bc7368e01e82f64b91" }, "downloads": -1, "filename": "sweetify-2.0.0.tar.gz", "has_sig": false, "md5_digest": "3748a5dada961498010dc209d5a93e09", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 5526, "upload_time": "2019-04-22T14:46:57", "url": "https://files.pythonhosted.org/packages/2f/ff/1906f06a4e764313877e3757a6db98c026332fb0b9b511e1bf77299e1534/sweetify-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9a7d3f0d045fec876ea17105a0842920", "sha256": "c57c1676eeac680a9acd645af1750edbe0d2fbf0128b276634e74ea890cd2979" }, "downloads": -1, "filename": "sweetify-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9a7d3f0d045fec876ea17105a0842920", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 6494, "upload_time": "2019-04-22T14:46:56", "url": "https://files.pythonhosted.org/packages/eb/57/df07cc01dbc883d4a554170d9f2f2a18a6dc93a26ab3104fe7f16797a798/sweetify-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3748a5dada961498010dc209d5a93e09", "sha256": "ae776b3f956f4a9af7236a613ba77b61002f690e7a60c0bc7368e01e82f64b91" }, "downloads": -1, "filename": "sweetify-2.0.0.tar.gz", "has_sig": false, "md5_digest": "3748a5dada961498010dc209d5a93e09", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 5526, "upload_time": "2019-04-22T14:46:57", "url": "https://files.pythonhosted.org/packages/2f/ff/1906f06a4e764313877e3757a6db98c026332fb0b9b511e1bf77299e1534/sweetify-2.0.0.tar.gz" } ] }