Giter Club home page Giter Club logo

django-opt-out's Introduction

Django Opt-out application

image

image

Documentation Status

Coveralls.io coverage

CodeCov coverage

Maintainability

License

Tweet about this project

image

Allow everybody to unsubscribe your messages, user accounts are not required.

Features

  • A single page form for opt-out feedback submission
  • Feedback options text controlled from django admin
  • Predefined feedback defaults available from django manage command
  • Feedback translations done in django admin
  • Feedback options selection based on tags supplied to the opt-out url
  • Ability to preselect a feedback option
  • Ability to change selected feedback options after submission
  • Ability to set tag:value pair on opt-out url and store them on submission with user feedback
  • Signal to modify opt-out form before rendering
  • Signal on opt-out feedback submission
  • Easily overridable thank you / goodbye view
  • Opt-out form with a easily overridable base template

Demo

To run an example project for this django reusable app, click the button below and start a demo serwer on Heroku

Deploy Django Opt-out example project to Heroku

Deploy Django Opt-out example project to Heroku

Quickstart

Install Django Opt-out application:

pip install django-opt-out

Add it to your `INSTALLED_APPS`:

INSTALLED_APPS = (
    ...
    'django_opt_out.apps.DjangoOptOutConfig',
    ...
)

Add Django Opt-out application's URL patterns:

from django_opt_out import urls as django_opt_out_urls


urlpatterns = [
    ...
    url(r'^', include(django_opt_out_urls)),
    ...
]

Add unsubscribe links to your emails:

from django_opt_out.utils import get_opt_out_path
email='Django Opt-out <[email protected]>'
unsubscribe = get_opt_out_path(email, 'some', 'tags', 'controlling', 'questionnaire')

# unsubscribe link will not have a domain name and scheme
# you can build prefix from request, but I prefer to set it in settings
from django.conf import settings
unsubscribe = settings.BASE_URL + unsubscribe
body = 'Hello, Regards\n\nUnsubscribe: ' + unsubscribe

from django.core import mail
message = mail.EmailMultiAlternatives(body=body, to=[email])
message.extra_headers['List-Unsubscribe'] = "<{}>".format(unsubscribe)
message.send()

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

This package was created with Cookiecutter and the wooyek/cookiecutter-django-app project template.

django-opt-out's People

Contributors

wooyek avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fossabot

django-opt-out's Issues

django-import-export is mandatory?

  • Django Opt-out application version: latest
  • Django version: 1.11.x
  • Python version: 3.5.x
  • Operating System: macOS

Description

Either update instruction or get rid of import_export library

django 1.11.x ?

  • Django Opt-out application version: latest
  • Django version: 1.11.x
  • Python version: 3.5.x
  • Operating System: Ubuntu 16.04 LTS

Description

Are you telling me that django 2.x is mandatory? If not can you fix requirements to not install django 2+ by default ?

What I Did

pip install django-opt-out

django.template.exceptions.TemplateSyntaxError: 'bootstrap' is not a registered tag library.

  • Django Opt-out application version: latest
  • Django version: 1.11.x
  • Python version: 3.5.x
  • Operating System: macOS

Description

Missing 'bootstrap' template tag library..

What I Did

Just follow installation instruction and try to load first opt-out view

Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 157, in __call__
    response = self.get_response(request)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 43, in inner
    response = response_for_exception(request, exc)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/response.py", line 107, in render
    self.content = self.rendered_content
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/response.py", line 82, in rendered_content
    template = self.resolve_template(self.template_name)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/response.py", line 64, in resolve_template
    return select_template(template, using=self.using)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/loader.py", line 48, in select_template
    return engine.get_template(template_name)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/backends/django.py", line 39, in get_template
    return Template(self.engine.get_template(template_name), self)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/engine.py", line 162, in get_template
    template, origin = self.find_template(template_name)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/engine.py", line 136, in find_template
    name, template_dirs=dirs, skip=skip,
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/loaders/cached.py", line 60, in get_template
    template_name, template_dirs, skip,
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/loaders/base.py", line 44, in get_template
    contents, origin, origin.template_name, self.engine,
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/base.py", line 191, in __init__
    self.nodelist = self.compile_nodelist()
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/base.py", line 230, in compile_nodelist
    return parser.parse()
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/base.py", line 515, in parse
    raise self.error(token, e)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/base.py", line 513, in parse
    compiled_result = compile_func(self, token)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/loader_tags.py", line 312, in do_extends
    nodelist = parser.parse()
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/base.py", line 515, in parse
    raise self.error(token, e)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/base.py", line 513, in parse
    compiled_result = compile_func(self, token)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/defaulttags.py", line 1095, in load
    lib = find_library(parser, name)
  File "/home/vagrant/.virtualenv/lib/python3.5/site-packages/django/template/defaulttags.py", line 1042, in find_library
    name, "\n".join(sorted(parser.libraries.keys())),
django.template.exceptions.TemplateSyntaxError: 'bootstrap' is not a registered tag library. Must be one of:
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.