Skip to main content

Another newsletter subscription app.

https://travis-ci.org/matthiask/django-newsletter-subscription.png?branch=master

Subscription flow

  • User enters his/her email address on /newsletter/.

  • A mail is sent to the given address containing a link of the form /newsletter/s/<signed_email_address>/.

  • Upon visiting the link the user is immediately subscribed for the newsletter. Optionally, a form asking the user for additional data is shown.

Unsubscription flow

  • The user enters his/her email address on /newsletter/ and is immediately unsubscribed.

  • An email is sent to the user informing him/her that the unsubscription took place. A link is provided to immediately subscribe again in case the unsubscription was not meant to take place. The link is of the form /newsletter/r/<signed_email_address>/.

Subscription model

The minimal set of database fields is as follows:

  • email (EmailField, unique)

  • is_active (BooleanField, defaults to False)

Usage

This example assumes you are using at least Django 1.4.

  1. Install django-newsletter-subscription using pip.

  2. Add a concrete model inheriting newsletter_subscription.models.SubscriptionBase with optionally additional fields about the subscription. You should be prepared to work without those additional fields – their presence is not enforced as per the subscription flow description above. A full example:

    from django.db import models
    from django.utils.translation import ugettext_lazy as _
    
    from newsletter_subscription.models import SubscriptionBase
    
    class Subscription(SubscriptionBase):
        full_name = models.CharField(_('full name'), max_length=100, blank=True)
  3. Add the URLconf entry:

    from .newsletter.models import Subscription
    
    from newsletter_subscription.backend import ModelBackend
    from newsletter_subscription.urls import newsletter_subscriptions_urlpatterns
    
    urlpatterns += patterns(
        '',
        url(
            r'^newsletter/',
            include(newsletter_subscriptions_urlpatterns(
                backend=ModelBackend(Subscription),
            )),
        ),
    )
  4. Register your own subscription model with django.contrib.admin.

  5. Add newsletter_subscription to INSTALLED_APPS if you want to use the bundled templates. The templates require Towel’s towel_form_tags template tag library.

  6. Ensure that Django’s messages framework is activated and that the messages are included in your templates, otherwise the notifications from django-newsletter-subscriptions will not be shown to the users.

Release files for django-newsletter-subscription 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-newsletter-subscription 0.5.0
File Size Uploaded
django-newsletter-subscription-0.5.0.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-newsletter-subscription 0.5.0
File Interpreter ABI Platform
django_newsletter_subscription-0.5.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 24.0 kB

Release files / django-newsletter-subscription-0.5.0.tar.gz

Download URL django-newsletter-subscription-0.5.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
71b195a08b8a543324d2d125535c093f895f03e1d90150d5d578ecb62b69425f
BLAKE2b-256 checksum
How to use checksums
04c25d2845dc6ee5a04f3b4bc8ab55bde3e44c549232e79e827e02f58592e15a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / django_newsletter_subscription-0.5.0-py2.py3-none-any.whl

Download URL django_newsletter_subscription-0.5.0-py2.py3-none-any.whl
Size 13.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2670ce5b7689d76cb9cf8ebc465892650e9d409bfb6d5a354cd28c7e8ff222ed
BLAKE2b-256 checksum
How to use checksums
9ae885bbdef23f25407696e429386546137c8c6ad3a601163c08af8c98817648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page