<commit_before>djangoshop-subscribe
====================

Django-SHOP plugin for email subscriptions

Introduction
------------

This plugin allows Django-SHOP implementations to add email
subscriptions for their customers.

The module is currently compatible with Django v1.10.7. This
documentation assumes a working knowledge of Django and
`Django-SHOP <http://django-shop.readthedocs.io/en/latest/>`__.

Release History
~~~~~~~~~~~~~~~

- 0.2.x - `Django-SHOP <https://github.com/awesto/django-shop>`__ v0.11.x compatibility
- 0.1.x - `Django-SHOP <https://github.com/awesto/django-shop>`__ v0.10.2 compatibility

Features
~~~~~~~~

This plugin currently has the following features:

-  Django-angular & bootstrap3 based subscription and confirmation forms
   that can be included in normal templates.
-  Automatic pickup of any Customer model fields that start with
   ``subscription_`` for inclusion in forms.
-  A CMS plugin for inclusion of either form in CMS placeholders.
-  Default confirmation and subscription management form, or use your
   own page.
-  A minimal customer form for the standard Django-SHOP checkout to
   prevent all fields annoying customers on every checkout.
-  Email link authentication for management of subscriptions.
-  Overridable forms and email templates including `Email
   Framework <https://github.com/g13nn/Email-Framework>`__ compatibility
   with the majority of email clients.
-  Rate limit for subscriptions from each ip address.
-  Email integration with post_office templates.

TODO
~~~~

Please let me know of you have any feature suggestions, or wish to
implement any of the below:

-  Admin interface to allow emails to be authored and sent out to
   subscribed users.
-  Tests.
-  Remove included email framework.
-  Continuous build integration including compatibility testing with
   various python, Django and Django-SHOP versions.

Integration Guide
-----------------

Please follow the guide below to integrate the plugin into your own
shop.

Configuration
~~~~~~~~~~~~~

Please add the following to your Django settings. If you do not use CMS
you do not need the CMS plugin.

.. code:: python

    INSTALLED_APPS = [
        ...
        'shop',
        'shop_subscribe',
        ...
    ]

    CMSPLUGIN_CASCADE_PLUGINS = [
        ...
        'shop_subscribe.cmsplugin_cascade',
    ]

A logging configuration similar to below is also recommended to catch a few warnings
given off by this module. This configuration will also catch messages given off by
other modules for which there is no specific configuration. If you want to add a
specific configuration for this module, use the module name ``shop_subscribe``.

.. code:: python

    LOGGING = {
        'version': 1,
        # Use False to see deprecation warnings, etc
        'disable_existing_loggers': False,
        'filters': {
             'require_debug_false': {
                 '()': 'django.utils.log.RequireDebugFalse',
             }
        },
        'formatters': {
            'simple': {
                'format': '[%(asctime)s %(name)s] %(levelname)s: %(message)s'
            },
        },
        'handlers': {
            'console': {
                'level': 'INFO',
                'class': 'logging.StreamHandler',
                'formatter': 'simple',
            },
        },
        'loggers': {
            '': {
                'handlers': ['console'],
                # default is WARNING
                'level': 'INFO',
            },
        },
    }

Customer Model
~~~~~~~~~~~~~~

For the subscription plugin to work, you must create your own customer
model that extends the provided shop customer model. There are two
requirements:

-  Add the ``SubscriptionCustomerManagerMixin`` to a manager class
-  Add your own subscription options to the customer model which MUST be
   prefixed with ``subscription_``

For example:

.. code:: python

    from shop.models.customer import BaseCustomer, CustomerManager as BaseCustomerManager
    from shop_subscribe.models import SubscriptionCustomerManagerMixin

<commit_msg>corrected recommended root logger config in README<commit_after>djangoshop-subscribe
====================

Django-SHOP plugin for email subscriptions

Introduction
------------

This plugin allows Django-SHOP implementations to add email
subscriptions for their customers.

The module is currently compatible with Django v1.10.7. This
documentation assumes a working knowledge of Django and
`Django-SHOP <http://django-shop.readthedocs.io/en/latest/>`__.

Release History
~~~~~~~~~~~~~~~

- 0.2.x - `Django-SHOP <https://github.com/awesto/django-shop>`__ v0.11.x compatibility
- 0.1.x - `Django-SHOP <https://github.com/awesto/django-shop>`__ v0.10.2 compatibility

Features
~~~~~~~~

This plugin currently has the following features:

-  Django-angular & bootstrap3 based subscription and confirmation forms
   that can be included in normal templates.
-  Automatic pickup of any Customer model fields that start with
   ``subscription_`` for inclusion in forms.
-  A CMS plugin for inclusion of either form in CMS placeholders.
-  Default confirmation and subscription management form, or use your
   own page.
-  A minimal customer form for the standard Django-SHOP checkout to
   prevent all fields annoying customers on every checkout.
-  Email link authentication for management of subscriptions.
-  Overridable forms and email templates including `Email
   Framework <https://github.com/g13nn/Email-Framework>`__ compatibility
   with the majority of email clients.
-  Rate limit for subscriptions from each ip address.
-  Email integration with post_office templates.

TODO
~~~~

Please let me know of you have any feature suggestions, or wish to
implement any of the below:

-  Admin interface to allow emails to be authored and sent out to
   subscribed users.
-  Tests.
-  Remove included email framework.
-  Continuous build integration including compatibility testing with
   various python, Django and Django-SHOP versions.

Integration Guide
-----------------

Please follow the guide below to integrate the plugin into your own
shop.

Configuration
~~~~~~~~~~~~~

Please add the following to your Django settings. If you do not use CMS
you do not need the CMS plugin.

.. code:: python

    INSTALLED_APPS = [
        ...
        'shop',
        'shop_subscribe',
        ...
    ]

    CMSPLUGIN_CASCADE_PLUGINS = [
        ...
        'shop_subscribe.cmsplugin_cascade',
    ]

A logging configuration similar to below is also recommended to catch a few warnings
given off by this module. This configuration will also catch messages given off by
other modules for which there is no specific configuration. If you want to add a
specific configuration for this module, use the module name ``shop_subscribe``.

.. code:: python

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'simple': {
                'format': '[%(asctime)s %(name)s] %(levelname)s: %(message)s'
            },
        },
        'handlers': {
            'console': {
                'level': 'INFO',
                'class': 'logging.StreamHandler',
                'formatter': 'simple',
            },
        },
        'root': {
            'handlers': ['console'],
            'level': 'INFO',
        },
    }

Customer Model
~~~~~~~~~~~~~~

For the subscription plugin to work, you must create your own customer
model that extends the provided shop customer model. There are two
requirements:

-  Add the ``SubscriptionCustomerManagerMixin`` to a manager class
-  Add your own subscription options to the customer model which MUST be
   prefixed with ``subscription_``

For example:

.. code:: python

    from shop.models.customer import BaseCustomer, CustomerManager as BaseCustomerManager
    from shop_subscribe.models import SubscriptionCustomerManagerMixin


{'fraction_non_alphanumeric': 0.09862007849094823, 'fraction_numerical': 0.004810735536143816, 'mean_word_length': 2.8916256157635467, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '699125', 'n_tokens_mistral': 2098, 'n_tokens_neox': 2000, 'n_words': 821}