{ "info": { "author": "Davide Riccardo Caliendo", "author_email": "davide.licheni.net", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "HOW IT WORKS\n============\n\n`mail_confirmation` is a general application for providing object approvation from users via email:\n\nyou create an object, tell `mail_confirmation` to *generate and send* a mail confirmation to the user, and the *user confirms* that object by clicking the url received in the *email*.\n\nYou can provide different templates, sensible defaults are provided, custom views or templates rendered when the user clicks on that confirmation link, and other settings. Stale requests are optionally handled with celery tasks.\n\nFor now emails are sent as html unless you provide your function to send emails. \n\nINSTALLATION\n============\n\n\nSet the mail confirmation urls:\n\n::\n\n from mail_confirmation.views import MailConfirmation\n\n #Mail url Confirmation\n urlpatterns += patterns('',\n url(r'^confirm/', include('mail_confirmation.urls', namespace='mail_confirmation')),\n )\n\nput the app in `installed_apps` settings:\n\n::\n\n INSTALLED_APPS += (\n 'mail_confirmation',\n )\n\nand then run syncdb\n\nIn the `model` that you want to confirm put a generic relation field:\n\n::\n\n from django.contrib.contenttypes import generic\n from mail_confirmation.models import MailConfirmation\n\n confirmed = generic.GenericRelation(MailConfirmation,\n content_type_field='toconfirm_type',\n object_id_field='toconfirm_id')\n\n\nnote also that in the orm you must check for `confirmed__confirmed=True`)\n\nYou **must** also provide a template in `youapplication/mail_request.html` that will be used as email body and a template in `yourapplication/mail_confirmation_succeded.html` that will display a thank you message for the user, you could override their names, see below.\n\nRead below on how to connect to a `signal` emitted whenever a model is confirmed by the user.\n\nSETTINGS\n========\n\n* `settings.SITE_SCHEME` defaults to http\n* `settings.MAIL_CONFIRMATION_STALE_PERIOD` period after deletion of stale requests\n* `settings.DEFAULT_FROM_EMAIL` if no email is provided as sender use this one\n\n\nThis app optionally uses the `sites framework` for retrieving the domain name of your site, and `SITE_SCHEME` in your settings to know what scheme (defaults to 'https') to use when building urls.\n\n\nUSAGE\n=====\n\nNote, you can look up `tests/test.py` to see an example of usage, see `MailConfirmationTest.test_confirmation` how uses the relevant object to confirm and how it is made from `tests.models`\n\nCreating your object\n--------------------\n\nsay you have a model `MyModel` with a `confirmed` field of the kind explained above:\n \n::\n\n obj = MyModel()\n\nand ask `mail_confirmation` to send a confirmation email to the user.\n\n\nSending confirmations to the user\n---------------------------------\n\nto *generate and send* a confirmation you put this snippet in your code (see below on how to generate a confirmation and send the email indipendently):\n\n::\n\n from mail_confirmation.utils import generate_and_send\n\n generate_and_send(obj,\n request_template,\n success_template, success_url,\n forusers,\n mail_function,\n subject, sender, to, confirmurlname, context)\n\n\n* `obj` in an instance of a model that needs a confirmation from the user.\n* `requerst_template` overrides the default template path used for building the request email.\n* `success_template` overrides the default template path used for the success view when the user visits the confirmation url from the email\n* `success_url` optionally you could specify an url to be used as a redirect when the user visits the confirmation url, this is used instead of the `success_template` above.\n* `forusers` a single or a list of users that can confirm this object, if not provided anyone with the link can confirm this object\n* `mail_function` if you don't want to use the default send_confirmation function you can specify a function used to send the email, the signature should be the same of `send_confirmation` in utils.py, Note that every additional argument you pass to generate_and_send will be also passed to your custom function.\n* `subject` is the optional email subject\n* `sender` is the optional email sender\n* `to` is the user email, or a list of user email, where the confirmation email is sent\n* `confirmurlname` if you put this app in a different namespace you can configure the url name used by `reverse` to compose the confirmation url by passing `confirmurlname='custom_appname:url'` to `send_confirmation` or `generate_and_send`\n* `context` is an optional context passed to the email template\n \n\nThe email is rendered by passing as context an optional `context` you provi and various variables used to build the confirmation url: `confirmation_url` is the path of that url, `SITE_DOMAIN` and `SITE_SCHEME` contains the site scheme and domain name.\n\n\n**Default values:**\n\n*Read this carefully to know where `mail confirmation` looks for picking up various templates*\n\n`request_template`: `yourapplication/templates/yourapplication/mail_request.html`\n\n `yourapplication` is the application the object you are trying to confirm belongs to, for example if I have `obj = appname.MyModel()`, then the mail request template will be searched in `appname/templates/appname/mail_request.html`\n\n`success_template`: `yourapplication/templates/yourapplication/mail_confirmation_succeded.html`,\n\n `yourapplication` has the same meaning as above\n\n`subject`: `\"Confirmation mail\"`\n\n`success_url`: None\n\n`sender`: `settings.DEFAULT_FROM_EMAIL`\n\n`confirmurlname`: `mail_confirmation:url`\n\n`SITE_SCHEME`: `https`\n\n`SITE_DOMAIN`: it uses the `Site` framework, `Site.objects.get_current().domain`. or looks in the settings for a `SITE_DOMAIN` attribute. \n\n\n**Example**\n\nGiven sensible defaults a generate and send call could be as simple as:\n\n::\n obj = MyModel()\n generate_and_send(obj, to='to@example.com')\n\n\n**NOTE**\n\nYou could optionally **split the confirmation generation and sending** by using those two functions, `generate_confirmation` and `send_confirmation`, look at `utils.py` to see their signature.\n\n\nRendering the mail template\n---------------------------\n\nThe email template receives your optional `context` and the `SITE_SCHEME`, `SITE_DOMAIN` and `confirmation_url` variables:\n\n::\n Hello, click the link below to confirm your object:\n url\n\n \nRendering the success(confirmation) template\n--------------------------------------------\n\nThe success template will have the `confirmation` object as context, you can access the object you want to confirm from `confirmation.toconfirm_object`.\n\n\nGetting the confirmed id (listening signals)\n--------------------------------------------\n\nWhenever a confirmation is made from an user a `signal` is emitted;\nyou can connect to that signal and do things\u2122 with this code:\n\n::\n\n from mail_confirmation.signals import confirmed_signal\n\n confirmed_signal.connect(my_callback)\n\nor\n\n::\n\n @receiver(confirmed_signal, \n sender=MailConfirmation)\n def my_callback(sender, toconfirm_type, object_id, **kwargs):\n if toconfirm_type == MyModel:\n print(\"do something\")\n\nwhere toconfirm_type is the model you passed as instance to the confirmation generation and object_id is the id of your MyModel object\n\n\nEnforcing permissions\n---------------------\n\nUsually for email confirmations it is enough to rely on the secrecy of the mailed link, some other times we want to be sure that only a given user has access to that link, this is done by associating one or more users to a particular mail confirmation, by providing `forusers` parameter to `generate_confirmation` or `generate_and_send`.\n\nThis will enforce the permission for the confirmation view, only a certain user if specified can confirm that object, if the user is already logged, a 403 is returned, if the user is anonymous then the login page is showed, with a next parameter of the confirmation url.\n\n\nClearing stale requests\n-----------------------\n\nimport from utils clear_stale() or a celery task that runs every first of the month is provided for you.\n\n::\n\n CELERY_IMPORTS += (\n 'mail_confirmation.tasks',\n ) \n\n\nyou also should set settings.MAIL_CONFIRMATION_STALE_PERIOD to a timedelta in days\n\nit defaults to 30 days, set it to 0 to disable temporarly\n\nTESTS\n=====\n\n`./manage.py test mail_confirmation --settings=mail_confirmation.tests.settings`\n\n\n\n\nCHANGELOG\n=========\n\n1.0:\n* possibility to use a custom mail function in `generate_and_send` instead of default `send_confirmation`\n* corrected the default values of `send_confirmation` function\n* changed the context in the email from `domain` to `SITE_DOMAIN` and `url` to `confirmation_url`\n* using `uuid4.hex` as confirmation ids for confirmation objects, prviously was generated in a slow as hell method.\n* passing the `confirmation` object in the rendered success template", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://v.licheni.net/drc/django-mail_confirmation.git", "keywords": null, "license": "GPLv3 License", "maintainer": null, "maintainer_email": null, "name": "django-mail_confirmation", "package_url": "https://pypi.org/project/django-mail_confirmation/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-mail_confirmation/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://v.licheni.net/drc/django-mail_confirmation.git" }, "release_url": "https://pypi.org/project/django-mail_confirmation/1.2.7/", "requires_dist": null, "requires_python": null, "summary": "A general django user mail confirmation app usable with multiple models at the same time.", "version": "1.2.7" }, "last_serial": 1708302, "releases": { "0.1": [], "0.2": [ { "comment_text": "", "digests": { "md5": "b8da001ed4b392eb98e911c8974772f1", "sha256": "f2ef874b6ab8844facc0ef3e90576c60c894ddb89c2e64217a318372c162819b" }, "downloads": -1, "filename": "django-mail_confirmation-0.2.tar.gz", "has_sig": false, "md5_digest": "b8da001ed4b392eb98e911c8974772f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17614, "upload_time": "2013-08-13T12:23:07", "url": "https://files.pythonhosted.org/packages/ba/03/e78d9fb6998b850a5f480e4ff8554b3ee37b140ba6102e04dd186a041da2/django-mail_confirmation-0.2.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "3beb88999b84fbda9a077fd948914c03", "sha256": "5d062a1162f5a3c748cb485ed6d6da5ed169b1058fe7dc10459d4c9250d08e7f" }, "downloads": -1, "filename": "django-mail_confirmation-0.4.tar.gz", "has_sig": false, "md5_digest": "3beb88999b84fbda9a077fd948914c03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17614, "upload_time": "2013-08-13T12:44:38", "url": "https://files.pythonhosted.org/packages/e0/aa/a1c4f258f34b6715d3cab87bf4367045a73260cc920f77a3580a84f1b5ef/django-mail_confirmation-0.4.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "a9093e7314e6f85fc42c4d938f76fc28", "sha256": "1cd86ad2a5c0ccb48ac95b31366ed11a396d44254343e4a0bf8d77cfe0effa73" }, "downloads": -1, "filename": "django-mail_confirmation-0.6.tar.gz", "has_sig": false, "md5_digest": "a9093e7314e6f85fc42c4d938f76fc28", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17967, "upload_time": "2013-09-08T16:03:46", "url": "https://files.pythonhosted.org/packages/82/52/9e9c31b1d610ceb2e27f396909419fa87a89b65cf45b489f2742b5e02f6d/django-mail_confirmation-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "3e398a0cb6581649e8ba9863e65538a9", "sha256": "d715298284b1c816be9530a698739d006f9852cec98f2a55b2f6605c42b125df" }, "downloads": -1, "filename": "django-mail_confirmation-0.6.1.tar.gz", "has_sig": false, "md5_digest": "3e398a0cb6581649e8ba9863e65538a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18056, "upload_time": "2013-09-09T14:24:41", "url": "https://files.pythonhosted.org/packages/21/0c/34b3cd5b1dae0a948f979b9d01108726d1c929109a81e717102bc44dcf9a/django-mail_confirmation-0.6.1.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "f01a77507669eeb9d1be87da67675c86", "sha256": "bb1f733be36e519215e0fcb5c77c0d96668dce8f078b9723c1eac5c5e447691d" }, "downloads": -1, "filename": "django-mail_confirmation-0.7.tar.gz", "has_sig": false, "md5_digest": "f01a77507669eeb9d1be87da67675c86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18184, "upload_time": "2014-10-22T10:10:58", "url": "https://files.pythonhosted.org/packages/11/73/d757c8094a476c0ff2e8842a12572173ca5718c50767ef19f653fa748575/django-mail_confirmation-0.7.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "a7f46a0085f0b1c18cf8e9fb95fc2710", "sha256": "7bcff8901913be595b3e77ee976d3f253c224a31f40dfc0bc206eef20e962fff" }, "downloads": -1, "filename": "django-mail_confirmation-0.7.1.tar.gz", "has_sig": false, "md5_digest": "a7f46a0085f0b1c18cf8e9fb95fc2710", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18228, "upload_time": "2014-10-22T10:21:52", "url": "https://files.pythonhosted.org/packages/59/ba/ab4b052456aa1cd9b95c5d7e0705e39edcc5011f92853999a923d632c65e/django-mail_confirmation-0.7.1.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "b292f5c2dd424cb97541a0fdb4f8e7a6", "sha256": "4842fc431f86c13d541e648a18795d360b0d2e1dbb5841956d9e6b7091838cc2" }, "downloads": -1, "filename": "django-mail_confirmation-0.8.0.tar.gz", "has_sig": false, "md5_digest": "b292f5c2dd424cb97541a0fdb4f8e7a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18282, "upload_time": "2015-01-19T20:33:28", "url": "https://files.pythonhosted.org/packages/79/17/5791bb0134dd4709c9d143abf8703baaec53ae3134453d6b6632e641236f/django-mail_confirmation-0.8.0.tar.gz" } ], "1.1": [], "1.2": [ { "comment_text": "", "digests": { "md5": "79ad0680451a4447224d9fbeb64294f2", "sha256": "ed00fcf1b4983ad8619be95e50f93ab74f0bbbf8ca24da41bdc33c33e63052ed" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.tar.gz", "has_sig": false, "md5_digest": "79ad0680451a4447224d9fbeb64294f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23634, "upload_time": "2015-02-19T00:20:31", "url": "https://files.pythonhosted.org/packages/20/9d/f3de306dc6f62c037aa5db55ad7c44ea32f9a59871b438033a54a940dbd4/django-mail_confirmation-1.2.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "9a3036c47d98065b18ef99d4b356dc47", "sha256": "f61137743d6cba0a534ccb49cb9ed8779a2eadd9fe3833c68dcb4bf2306b311e" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.1.tar.gz", "has_sig": false, "md5_digest": "9a3036c47d98065b18ef99d4b356dc47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23690, "upload_time": "2015-02-19T18:57:17", "url": "https://files.pythonhosted.org/packages/13/20/a9e4bc20cda06856bcd77375d7d14b4539f0ffe9510cdae7de0d25bb2218/django-mail_confirmation-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "97d0d92716b6184d15f038dbf803072a", "sha256": "60f8f48928dcc65a80daeff21afb5befcdb1cf095cb9dba40d04e2cd82b6df9c" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.2.tar.gz", "has_sig": false, "md5_digest": "97d0d92716b6184d15f038dbf803072a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23684, "upload_time": "2015-02-19T19:51:32", "url": "https://files.pythonhosted.org/packages/14/54/c8b8458a31ca8f615240f5978b6d780ab08a18e7f65448f60b76a465e58f/django-mail_confirmation-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "a2d59b1a8b590a5109765cf140816879", "sha256": "4a1a5b17bc2668733d1219431516860c20e3406a32ec233a5152b9d8b7f02105" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.3.tar.gz", "has_sig": false, "md5_digest": "a2d59b1a8b590a5109765cf140816879", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23757, "upload_time": "2015-02-28T20:10:19", "url": "https://files.pythonhosted.org/packages/27/46/42effbca6b2d2d88c17328396577d05893e4aec104f490a7f888eab516b7/django-mail_confirmation-1.2.3.tar.gz" } ], "1.2.4": [ { "comment_text": "", "digests": { "md5": "4deb444652ba0daec1ba8c192a867bf2", "sha256": "146e87f85b52d233f920a7122998db01d5cd89f2ba2a718c6b947935cfeb4241" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.4.tar.gz", "has_sig": false, "md5_digest": "4deb444652ba0daec1ba8c192a867bf2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23891, "upload_time": "2015-03-03T10:30:54", "url": "https://files.pythonhosted.org/packages/a2/b0/be94a61bf2c1e86a855287d14deaf7256e2b31ae764a8930ccb7a09647d4/django-mail_confirmation-1.2.4.tar.gz" } ], "1.2.5": [ { "comment_text": "", "digests": { "md5": "c4970d6acffbbf70aafe57094429b1b5", "sha256": "c09fcb3c3723344c40005876aafb0837ea736b8f5aaf3b1970d26a89dd1822d9" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.5.tar.gz", "has_sig": false, "md5_digest": "c4970d6acffbbf70aafe57094429b1b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23968, "upload_time": "2015-03-03T10:54:18", "url": "https://files.pythonhosted.org/packages/fc/8b/5c37e2bb41680648e12877b7f456c4a856d377b4f1ec3534dc73b3b25280/django-mail_confirmation-1.2.5.tar.gz" } ], "1.2.6": [ { "comment_text": "", "digests": { "md5": "4d75a70025136c3f736cc27108e7f08f", "sha256": "7ef75a48bab29a246a03c01008f2f676ed3dfc1bfc1979b98c835fc31808754a" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.6.tar.gz", "has_sig": false, "md5_digest": "4d75a70025136c3f736cc27108e7f08f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23966, "upload_time": "2015-03-03T11:04:40", "url": "https://files.pythonhosted.org/packages/88/fa/6c0d39bd3cf9914f59eeb79a5eb5cbde6d34b7bbea578618c704abb892d6/django-mail_confirmation-1.2.6.tar.gz" } ], "1.2.7": [ { "comment_text": "", "digests": { "md5": "0e3c3f5946161d4dd9bb64662b8d5105", "sha256": "9aefea7cdb70524830e2c74524aacd48228ba9561112ed4ba7caa05e97dd1b87" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.7.tar.gz", "has_sig": false, "md5_digest": "0e3c3f5946161d4dd9bb64662b8d5105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23877, "upload_time": "2015-09-04T16:37:50", "url": "https://files.pythonhosted.org/packages/95/a2/e77c273319d580e76e12b0dc83386bfd224655575f6193e9ca029e839630/django-mail_confirmation-1.2.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e3c3f5946161d4dd9bb64662b8d5105", "sha256": "9aefea7cdb70524830e2c74524aacd48228ba9561112ed4ba7caa05e97dd1b87" }, "downloads": -1, "filename": "django-mail_confirmation-1.2.7.tar.gz", "has_sig": false, "md5_digest": "0e3c3f5946161d4dd9bb64662b8d5105", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23877, "upload_time": "2015-09-04T16:37:50", "url": "https://files.pythonhosted.org/packages/95/a2/e77c273319d580e76e12b0dc83386bfd224655575f6193e9ca029e839630/django-mail_confirmation-1.2.7.tar.gz" } ] }