Skip to main content

Another newsletter subscription app.

Project description

Another newsletter subscription app.

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.

  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-newsletter-subscription-0.0.1.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file django-newsletter-subscription-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-newsletter-subscription-0.0.1.tar.gz
Algorithm Hash digest
SHA256 da7d394489dd3109acdf1c9ca2926320ecbb17c9f58288b9532a30ccdcbd026c
MD5 3bfabf1fb6dce1e7b8e2aa248292a29d
BLAKE2b-256 209fe2f4a14c4ac050982dc558f82eff39b332cacd451d05dabd76b5cb46f895

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page