django-newsletter-signup


Namedjango-newsletter-signup JSON
Version 0.7.5 PyPI version JSON
download
home_pagehttps://github.com/bitmazk/django-newsletter-signup
SummaryA reusable Django app, that handles newsletter subscriptions
upload_time2023-01-05 09:13:46
maintainer
docs_urlNone
authorDaniel Kaufhold
requires_python
licenseThe MIT License
keywords django app reusable newsletter signup subscription email
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Django Newsletter Signup
========================

A reusable Django app, that handles newsletter subscriptions.

Important note!
+++++++++++++++

If you upgrade from 0.2 upwards, you need to be aware, that the migrations were
reset. They used to be south, but they have been re-created to new Django
migrations in 0.3.

If you're first install is on 0.3 or beyond, you don't have to do anything.

Installation
------------

To get the latest stable release from PyPi

.. code-block:: bash

    pip install django-newsletter-signup

To get the latest commit from GitHub

.. code-block:: bash

    pip install -e git+git://github.com/bitmazk/django-newsletter-signup.git#egg=newsletter_signup

Add ``newsletter_signup`` to your ``INSTALLED_APPS``

.. code-block:: python

    INSTALLED_APPS = (
        ...,
        'newsletter_signup',
    )

Add the ``newsletter_signup`` URLs to your ``urls.py``

.. code-block:: python

    urlpatterns = patterns('',
        ...
        url(r'^newsletter/', include('newsletter_signup.urls')),
    )

Add the provided middleware to catch all referrers

.. code-block:: python

    MIDDLEWARE_CLASSES = (
        '...',  # your other middlewares
        'newsletter.middleware.GetRefererMiddleware',
    )

Don't forget to migrate your database

.. code-block:: bash

    ./manage.py migrate newsletter_signup


Usage
-----

Just link to the signup page or fetch it's contents via AJAX into e.g. a
bootstrap modal. Once a user fills out the subscription form she gets a
verification email, that on click makes the Subscription verified.

Future updates might include mailchimp integration to have everything setup
right away. For now you then need to gather the emails from the admin or your
own custom management views that you want to send mails to, or alternatively
create a custom management command.

Management Commands
-------------------

check_newsletter_signups
++++++++++++++++++++++++

This command will iterate through all signups and check if there's a user in
the system matching a signup's email. You might want to run this command in a
cron job.

Settings
--------

DOMAIN
++++++

``Default = 'locahost:8000'``

``DOMAIN`` is the hostname of your site.

.. code-block:: python

    DOMAIN = 'example.com'

NEWSLETTER_SIGNUP_FROM_EMAIL
++++++++++++++++++++++++++++

To set the from email in the mails, you can either specifically set the
``NEWSLETTER_SIGNUP_FROM_EMAIL`` setting or only the ``FROM_EMAIL`` setting,
which it per default falls back to.

..code-block:: python

    NEWSLETTER_SIGNUP_FROM_EMAIL = 'news@example.com'


NEWSLETTER_SIGNUP_SUBSCRIBE_SUBJECT and NEWSLETTER_SIGNUP_UNSUBSCRIBE_SUBJECT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Both of these setting work in the same way as they set the email subject for
the subscripe and unsubscribe email. You can either provide a string or a
callable object receiving the subscription object as a parameter.
See ``models.py`` for details. Alternatively you could overwrite those two
templates ``email/unsubscripe_subject.html`` and
``email/subscripe_subject.html``.

..code-block:: python

    SUBSCRIBE_SUBJECT = 'Your subscription to our newsletter!'

    UNSUBSCRIBE_SUBJECT = lambda sub: '{0} was unsubscribed.'.format(
        sub.email)


NEWSLETTER_SIGNUP_FORCE_MODAL
+++++++++++++++++++++++++++++

``Default = False``

If you use a modal or some other kind of visual element, to hint at the
newsletter, you can set this to True to always show it.

It's intended, that you do something like this in your template::

    {% if not request.session.has_seen_newsletter_signup_modal %}
        {% has_seen_modal %}
        {% include "path/to/newsletter_signup_modal.html" %}
    {% endif %}

The ``has_seen_modal`` template tag sets the session value
``has_seen_newsletter_signup_modal`` to ``True`` when the tag is rendered.

That way, the user won't see the modal the next time the view is called, unless
you set ``NEWSLETTER_SIGNUP_FORCE_MODAL`` to ``True``, since that prevents the
session value from becoming ``True`` in the first place.

NEWSLETTER_SIGNUP_NAME_REQUIRED
+++++++++++++++++++++++++++++++

``Default = False``

If set to ``True`` this setting will add ``first_name`` and ``last_name`` fields
to the signup form. These values are then stored on the ``NewsletterSignup``
model.

NEWSLETTER_SIGNUP_VERIFICATION_REQUIRED
+++++++++++++++++++++++++++++++++++++++

``Default = False``

If set to ``True`` the user will receive an email after signing up with a
verification link.
Same goes for unsubscription.
Per default the user is just (un)subscribed on form submit.


Contribute
----------

If you want to contribute to this project, please perform the following steps

.. code-block:: bash

    # Fork this repository
    # Clone your fork
    mkvirtualenv -p python2.7 django-newsletter-signup
    make develop

    git co -b feature_branch master
    # Implement your feature and tests
    git add . && git commit
    git push -u origin feature_branch
    # Send us a pull request for your feature branch

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bitmazk/django-newsletter-signup",
    "name": "django-newsletter-signup",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django,app,reusable,newsletter,signup,subscription,email",
    "author": "Daniel Kaufhold",
    "author_email": "daniel.kaufhold@bitmazk.com",
    "download_url": "https://files.pythonhosted.org/packages/13/7c/ed6fcba2c8d6441aaafadefb9f3fe97decffecc48e7119a79f2b11a95045/django-newsletter-signup-0.7.5.tar.gz",
    "platform": "OS Independent",
    "description": "Django Newsletter Signup\n========================\n\nA reusable Django app, that handles newsletter subscriptions.\n\nImportant note!\n+++++++++++++++\n\nIf you upgrade from 0.2 upwards, you need to be aware, that the migrations were\nreset. They used to be south, but they have been re-created to new Django\nmigrations in 0.3.\n\nIf you're first install is on 0.3 or beyond, you don't have to do anything.\n\nInstallation\n------------\n\nTo get the latest stable release from PyPi\n\n.. code-block:: bash\n\n    pip install django-newsletter-signup\n\nTo get the latest commit from GitHub\n\n.. code-block:: bash\n\n    pip install -e git+git://github.com/bitmazk/django-newsletter-signup.git#egg=newsletter_signup\n\nAdd ``newsletter_signup`` to your ``INSTALLED_APPS``\n\n.. code-block:: python\n\n    INSTALLED_APPS = (\n        ...,\n        'newsletter_signup',\n    )\n\nAdd the ``newsletter_signup`` URLs to your ``urls.py``\n\n.. code-block:: python\n\n    urlpatterns = patterns('',\n        ...\n        url(r'^newsletter/', include('newsletter_signup.urls')),\n    )\n\nAdd the provided middleware to catch all referrers\n\n.. code-block:: python\n\n    MIDDLEWARE_CLASSES = (\n        '...',  # your other middlewares\n        'newsletter.middleware.GetRefererMiddleware',\n    )\n\nDon't forget to migrate your database\n\n.. code-block:: bash\n\n    ./manage.py migrate newsletter_signup\n\n\nUsage\n-----\n\nJust link to the signup page or fetch it's contents via AJAX into e.g. a\nbootstrap modal. Once a user fills out the subscription form she gets a\nverification email, that on click makes the Subscription verified.\n\nFuture updates might include mailchimp integration to have everything setup\nright away. For now you then need to gather the emails from the admin or your\nown custom management views that you want to send mails to, or alternatively\ncreate a custom management command.\n\nManagement Commands\n-------------------\n\ncheck_newsletter_signups\n++++++++++++++++++++++++\n\nThis command will iterate through all signups and check if there's a user in\nthe system matching a signup's email. You might want to run this command in a\ncron job.\n\nSettings\n--------\n\nDOMAIN\n++++++\n\n``Default = 'locahost:8000'``\n\n``DOMAIN`` is the hostname of your site.\n\n.. code-block:: python\n\n    DOMAIN = 'example.com'\n\nNEWSLETTER_SIGNUP_FROM_EMAIL\n++++++++++++++++++++++++++++\n\nTo set the from email in the mails, you can either specifically set the\n``NEWSLETTER_SIGNUP_FROM_EMAIL`` setting or only the ``FROM_EMAIL`` setting,\nwhich it per default falls back to.\n\n..code-block:: python\n\n    NEWSLETTER_SIGNUP_FROM_EMAIL = 'news@example.com'\n\n\nNEWSLETTER_SIGNUP_SUBSCRIBE_SUBJECT and NEWSLETTER_SIGNUP_UNSUBSCRIBE_SUBJECT\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nBoth of these setting work in the same way as they set the email subject for\nthe subscripe and unsubscribe email. You can either provide a string or a\ncallable object receiving the subscription object as a parameter.\nSee ``models.py`` for details. Alternatively you could overwrite those two\ntemplates ``email/unsubscripe_subject.html`` and\n``email/subscripe_subject.html``.\n\n..code-block:: python\n\n    SUBSCRIBE_SUBJECT = 'Your subscription to our newsletter!'\n\n    UNSUBSCRIBE_SUBJECT = lambda sub: '{0} was unsubscribed.'.format(\n        sub.email)\n\n\nNEWSLETTER_SIGNUP_FORCE_MODAL\n+++++++++++++++++++++++++++++\n\n``Default = False``\n\nIf you use a modal or some other kind of visual element, to hint at the\nnewsletter, you can set this to True to always show it.\n\nIt's intended, that you do something like this in your template::\n\n    {% if not request.session.has_seen_newsletter_signup_modal %}\n        {% has_seen_modal %}\n        {% include \"path/to/newsletter_signup_modal.html\" %}\n    {% endif %}\n\nThe ``has_seen_modal`` template tag sets the session value\n``has_seen_newsletter_signup_modal`` to ``True`` when the tag is rendered.\n\nThat way, the user won't see the modal the next time the view is called, unless\nyou set ``NEWSLETTER_SIGNUP_FORCE_MODAL`` to ``True``, since that prevents the\nsession value from becoming ``True`` in the first place.\n\nNEWSLETTER_SIGNUP_NAME_REQUIRED\n+++++++++++++++++++++++++++++++\n\n``Default = False``\n\nIf set to ``True`` this setting will add ``first_name`` and ``last_name`` fields\nto the signup form. These values are then stored on the ``NewsletterSignup``\nmodel.\n\nNEWSLETTER_SIGNUP_VERIFICATION_REQUIRED\n+++++++++++++++++++++++++++++++++++++++\n\n``Default = False``\n\nIf set to ``True`` the user will receive an email after signing up with a\nverification link.\nSame goes for unsubscription.\nPer default the user is just (un)subscribed on form submit.\n\n\nContribute\n----------\n\nIf you want to contribute to this project, please perform the following steps\n\n.. code-block:: bash\n\n    # Fork this repository\n    # Clone your fork\n    mkvirtualenv -p python2.7 django-newsletter-signup\n    make develop\n\n    git co -b feature_branch master\n    # Implement your feature and tests\n    git add . && git commit\n    git push -u origin feature_branch\n    # Send us a pull request for your feature branch\n",
    "bugtrack_url": null,
    "license": "The MIT License",
    "summary": "A reusable Django app, that handles newsletter subscriptions",
    "version": "0.7.5",
    "split_keywords": [
        "django",
        "app",
        "reusable",
        "newsletter",
        "signup",
        "subscription",
        "email"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aeb5a60fc9114ad1967f11c2e58c687cab90a4d0b58e288f91dcafaeac3d12de",
                "md5": "c0b2fb01552e5609e182d57b90a14e59",
                "sha256": "446f85f07433c4fa13860f81e53081c4e595b1d333690c63964889456f8a873f"
            },
            "downloads": -1,
            "filename": "django_newsletter_signup-0.7.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0b2fb01552e5609e182d57b90a14e59",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24606,
            "upload_time": "2023-01-05T09:13:44",
            "upload_time_iso_8601": "2023-01-05T09:13:44.812608Z",
            "url": "https://files.pythonhosted.org/packages/ae/b5/a60fc9114ad1967f11c2e58c687cab90a4d0b58e288f91dcafaeac3d12de/django_newsletter_signup-0.7.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "137ced6fcba2c8d6441aaafadefb9f3fe97decffecc48e7119a79f2b11a95045",
                "md5": "6294bdb7b61a8e38a899a422d5c3c8d8",
                "sha256": "90be527c95ad212bc3705957adce04f1410fc4b88d34b34f337a4b16337416e9"
            },
            "downloads": -1,
            "filename": "django-newsletter-signup-0.7.5.tar.gz",
            "has_sig": false,
            "md5_digest": "6294bdb7b61a8e38a899a422d5c3c8d8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16154,
            "upload_time": "2023-01-05T09:13:46",
            "upload_time_iso_8601": "2023-01-05T09:13:46.550898Z",
            "url": "https://files.pythonhosted.org/packages/13/7c/ed6fcba2c8d6441aaafadefb9f3fe97decffecc48e7119a79f2b11a95045/django-newsletter-signup-0.7.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-05 09:13:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "bitmazk",
    "github_project": "django-newsletter-signup",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "test_requirements": [],
    "tox": true,
    "lcname": "django-newsletter-signup"
}
        
Elapsed time: 0.03005s