Skip to main content

diddemo-newsletter

Demo Newsletter is a Django app that manages your newsletter subscriptions

Quick start:

  1. Add "newsletter" to your INSTALLED_APPS setting like this.

    INSTALLED_APPS = [ ... 'newsletter', ]

  2. Include the polls URLconf in your project urls.py like this.

    path('', include('newsletter.urls', namespace="news")),

  3. Run "python manage.py migrate" to create the NewsLetter models.

Optional settings:

  1. NL_REDIRECT_HTML

    Defailts to 'news/news_letter.html'. You can overwrite this settings by adding NL_REDIRECT_HTML = 'your_html_location' to your settings.py file.

  2. UNSUBSCRIBE_DICT

    Defaults to {}. You can overwrite this setting by adding UNSUBSCRIBE_DICT = { "1": "Your first unsubscribe reason", "2": "Your second unsubscribe reason", "3": "Your third unsubscribe reason", "4": "Your forth unsubscribe reason" }, to your settings.py file.

    Note: "Not specified" will be used when KeyError is raised when processing an unsubscribe request

Note: More settings coming soon

Configuration:

Main model: NewsLetter Model form: NewsLetterForm - the form has an email field only TemplateTag: {% nl_unsubscribe email=user_email reason=your_reason_key %}

  1. Code example:

    views.py:

     from django.views.generic.edit import FormView
     from newsletter.forms import NewsLetterForm
    
     class ExampleView(FormView):
    
     	template_name = "example.html"
     	form_class = NewsLetterForm
     	success_url = "/news-letter"
    
     	def form_valid(self, form):
     		form.save()
     		return super().form_valid(form)
    

    urls.py:

     from django.urls import path
     from . import views
    
     app_name = "your_app_name"
    
     urlpatterns = [
     	path("example", views.ExampleView.as_view(), name="example"),
    

    example.html:

     <form class="your-classes" id="newsletterform" method="POST">
       {% csrf_token %}
       <input type="email" class="your-classes" placeholder="Your email address.."  id="{{form.email.id_for_label}}" name="{{form.email.name}}">
       <button class="your-classes" type="submit">Subscribe</button>
     </form>
    

    Your email html:

    {% load news_tags %}

    ...
      <a href="{% nl_unsubscribe email=email_address reason=reason_key %}">unsubscribe</a>
    

    ...

Metadata

Release files for django-manage-newsletter 0.0.2

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-manage-newsletter 0.0.2
File Size Uploaded
django-manage-newsletter-0.0.2.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-manage-newsletter 0.0.2
File Interpreter ABI Platform
django_manage_newsletter-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / django-manage-newsletter-0.0.2.tar.gz

Download URL django-manage-newsletter-0.0.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0fc8939501152df943f5b06c55f3effdfd7c0e7ac2da111c322c159475a8c0a0
BLAKE2b-256 checksum
How to use checksums
52cf389d52a6cefce3db8355a009e5f281543e25b3820649bcfe2f1ecca2d7b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.3

Release files / django_manage_newsletter-0.0.2-py3-none-any.whl

Download URL django_manage_newsletter-0.0.2-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4648f80addd7c9af0b047cca939d4a92fbdaf11a11d7f16566b5a4e0a8b47606
BLAKE2b-256 checksum
How to use checksums
10da1edc8e6e79bf4a41440a46b2ababf15ac641f0a9500298b6e58652161594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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