{"id":15356633,"url":"https://github.com/vinta/django-email-confirm-la","last_synced_at":"2025-04-15T06:42:11.321Z","repository":{"id":22639771,"uuid":"25982628","full_name":"vinta/django-email-confirm-la","owner":"vinta","description":"Django email confirmation for any model and any field","archived":false,"fork":false,"pushed_at":"2024-02-15T06:10:56.000Z","size":99,"stargazers_count":31,"open_issues_count":8,"forks_count":27,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-15T06:42:07.809Z","etag":null,"topics":["django","email","email-confirmation","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinta.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-30T17:45:11.000Z","updated_at":"2025-03-15T20:43:44.000Z","dependencies_parsed_at":"2024-06-21T16:53:54.512Z","dependency_job_id":"7944a6ed-dcdc-43d1-82cc-e135ddc29d68","html_url":"https://github.com/vinta/django-email-confirm-la","commit_stats":{"total_commits":104,"total_committers":6,"mean_commits":"17.333333333333332","dds":"0.22115384615384615","last_synced_commit":"f25202fc7402ebe7feccb52c12225865904e51bc"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinta%2Fdjango-email-confirm-la","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinta%2Fdjango-email-confirm-la/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinta%2Fdjango-email-confirm-la/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinta%2Fdjango-email-confirm-la/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinta","download_url":"https://codeload.github.com/vinta/django-email-confirm-la/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023727,"owners_count":21199958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","email","email-confirmation","python"],"created_at":"2024-10-01T12:29:24.390Z","updated_at":"2025-04-15T06:42:11.303Z","avatar_url":"https://github.com/vinta.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-email-confirm-la\n=======================\n\n.. image:: http://img.shields.io/pypi/v/django-email-confirm-la.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/django-email-confirm-la\n\nDjango email confirmation for any Model and any Field.\n\nRequirements\n============\n\n- Python (3.5, 3.6, 3.7, 3.8)\n- Django (2.0, 2.1, 2.2, 3.0, 3.1)\n\nInstallation\n============\n\n.. code-block:: bash\n\n    $ pip install django-email-confirm-la\n\n\nIn your ``settings.py``:\n\nAdd the ``email_confirm_la`` app (put it *after* your apps) and set the required settings:\n\n.. code-block:: python\n\n    INSTALLED_APPS = (\n        ...\n        'your_app',\n        'email_confirm_la',\n        ...\n    )\n\n    EMAIL_CONFIRM_LA_HTTP_PROTOCOL = 'https'\n    EMAIL_CONFIRM_LA_DOMAIN = 'vinta.ws'\n    EMAIL_CONFIRM_LA_AUTOLOGIN = True\n    EMAIL_CONFIRM_LA_TEMPLATE_CONTEXT = {\n        'THE_ANSWER': 42,\n    }\n\nIf you are using the `sites \u003chttps://docs.djangoproject.com/en/dev/ref/contrib/sites/\u003e`_ framework, then ``EMAIL_CONFIRM_LA_DOMAIN`` can be omitted and ``Site.objects.get_current().domain`` will be used.\n\nIn your ``urls.py``:\n\n.. code-block:: python\n\n    urlpatterns = [\n        ...\n        url(r'^email_confirmation/', include('email_confirm_la.urls', namespace='email_confirm_la')),\n        ...\n    ]\n\nthen run\n\n.. code-block:: bash\n\n    $ python manage.py migrate\n\nModels\n======\n\nFor User Model\n==============\n\n.. code-block:: python\n\n    from django.contrib.auth.models import User\n    from email_confirm_la.models import EmailConfirmation\n\n    user = User.objects.get(username='vinta')\n    email = 'vinta.chen@gmail.com'\n    EmailConfirmation.objects.verify_email_for_object(email, user)\n\nFor Any Model And Any Field\n===========================\n\nAssumed you have a model:\n\n.. code-block:: python\n\n    from django.db import models\n    from django.contrib.contenttypes.fields import GenericRelation  # Django 1.7+\n    from django.contrib.contenttypes.generic import GenericRelation\n\n    class YourModel(models.Model):\n        ...\n        customer_support_email = models.EmailField(max_length=255, null=True, blank=True)\n        marketing_email = models.EmailField(max_length=255, null=True, blank=True)\n        ...\n\n        # optional, but recommended when you want to perform cascade-deletions\n        email_confirmations = GenericRelation('email_confirm_la.EmailConfirmation', content_type_field='content_type', object_id_field='object_id')\n\nAnd you want to verify some emails:\n\n.. code-block:: python\n\n    from your_app.models import YourModel\n    from email_confirm_la.models import EmailConfirmation\n\n    some_model_instance = YourModel.objects.get(id=42)\n\n    EmailConfirmation.objects.verify_email_for_object(\n        email='marvin@therestaurantattheendoftheuniverse.com',\n        content_object=some_model_instance,\n        email_field_name='customer_support_email'\n    )\n\n    EmailConfirmation.objects.verify_email_for_object(\n        email='arthur.dent@therestaurantattheendoftheuniverse.com',\n        content_object=some_model_instance,\n        email_field_name='marketing_email'\n    )\n\nSignals\n=======\n\n- ``post_email_confirmation_send``\n- ``post_email_confirmation_confirm``\n\nIn your ``models.py``:\n\n.. code-block:: python\n\n    from django.dispatch import receiver\n    from email_confirm_la.signals import post_email_confirmation_confirm\n\n    @receiver(post_email_confirmation_confirm)\n    def post_email_confirmation_confirm_callback(sender, confirmation, **kwargs):\n        model_instace = confirmation.content_object\n        email = confirmation.email\n        old_email = kwargs['old_email']\n\n        do_your_stuff()\n\nCommands\n========\n\n.. code-block:: bash\n\n    $ python manage.py clear_expired_email_confirmations\n\nTemplates\n=========\n\nYou will want to override the project's email message and confirmation pages.\n\nEnsure the ``email_confirm_la`` app in ``INSTALLED_APPS`` is after the app that you will place the customized templates in so that the `django.template.loaders.app_directories.Loader \u003chttps://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.app_directories.Loader\u003e`_ finds *your* templates first.\n\nThere are following template that you can override:\n\n* ``email_confirm_la/email/email_confirmation_subject.txt``: Produces the subject line of the email.\n* ``email_confirm_la/email/email_confirmation_message.html``: The HTML body of the email.\n* ``email_confirm_la/email_confirmation_success.html``: What the user sees after clicking a confirmation link (on success).\n* ``email_confirm_la/email_confirmation_fail.html:`` What the user sees after clicking a invalid confirmation link.\n* ``email_confirm_la/email_confirmation_expiration.html:`` What the user sees after clicking an expired confirmation link.\n\nSettings\n========\n\nDefault values of app settings:\n\n.. code-block:: python\n\n    EMAIL_CONFIRM_LA_HTTP_PROTOCOL = 'http'\n    EMAIL_CONFIRM_LA_DOMAIN = 'example.com'\n    EMAIL_CONFIRM_LA_CONFIRM_EXPIRE_SEC = 60 * 60 * 24 * 1  # 1 day\n    EMAIL_CONFIRM_LA_CONFIRM_URL_REVERSE_NAME = 'email_confirm_la:confirm_email'\n    EMAIL_CONFIRM_LA_TEMPLATE_CONTEXT = {}\n    EMAIL_CONFIRM_LA_AUTOLOGIN = False\n\nRun Tests\n=========\n\n.. code-block:: bash\n\n    $ pip install -r requirements_test.txt\n    $ python setup.py test\n\n    # or\n\n    $ docker build -t email_confirm_la .\n    $ docker run --rm=true -v `pwd`:/app email_confirm_la\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinta%2Fdjango-email-confirm-la","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinta%2Fdjango-email-confirm-la","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinta%2Fdjango-email-confirm-la/lists"}