dokterbob/django-newsletter — pull request #80 by jkuczm (2013-07-21 21:39:34+00:00)
Title: Redirections

First part of solution to #77.

Since there are lot of changes in the same places as in confirmation_email branch I've based redirections branch on confirmation_email and commits from Jul 19, 2013 are from confirmation_email branch.

1. Unified `action in ...` assertions
* Added `ACTIONS` tuple to utils.py.
* Used `utils.ACTIONS` in views.py, models.py, test_maling.py.

2. Refactored views
* Added `ProcessUrlDataMixin` that processes args and kwargs from url before before dispatching request.
* Added `ActionMixin` mixin retrieving action and adding it to context.
* Added `ActionTemplateView` that renders a template for proper action, with newsletter and action in context.
* Added `ActionFormView` FormView with newsletter and action support.
* Adapted views to inheritance from above mixins/base views.

3. Added "success" pages
* Added urls and templates with info about sent email.
* Added urls and templates with info about activation success.
* Add tests for new pages.

4. Added redirections for anonymous user's actions
* Added redirection after activation email is sent.
* Added redirection after action is successfully activated.
* Added redirection after action request for switched off email confirmation.
* Adapted templates.
* Adapted tests.