Skip to content

Commit

Permalink
Merge pull request #178 from rootstrap/develop
Browse files Browse the repository at this point in the history
Develop to master v.1.6.2
  • Loading branch information
jumcorredorro authored Aug 12, 2022
2 parents d248be0 + 54a75b4 commit bdd2d0d
Show file tree
Hide file tree
Showing 36 changed files with 1,429 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pytest-django = "==4.5.2"
pytest-celery = "==0.0.0"

[packages]
Django = "==3.2.14"
Django = "==3.2.15"
apscheduler = "==3.7.0"
celery = "==5.2.2"

Expand Down
96 changes: 48 additions & 48 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/images/add_drip_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/body_html_template_field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 33 additions & 1 deletion docs/source/content/create.drip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,43 @@ On the other hand, when you click in the ``FIELD NAME OF USER`` input, you will

Here you can relate the Drip to the corresponding ``Campaign``. Grouping several drips under a campaign.


Resend drip field
-----------------

The default behaviour of Drip library is that an email could only be sent to one user every time.
Now with the field ``Can resend drip`` you could be able to send the same drip email to one user multiple times. Every time the user matches the conditions, it will receive the email.
If the field is set to True, the ``SentDrip`` model will not be used to exclude users from queryset. This field could be functional, if you mix it up with some datetime conditions when building your drip.


Unsubscribe users from emails
-----------------------------

We support unsubscribing from ``Drip``, ``Campaign``, and also all emails (all emails sent by this library).

Once you configure the key ``DRIP_UNSUBSCRIBE_USERS``to ``True`` in the settings file. The Drip creation page will change the ``Body html template`` field help text:

.. image:: ../../images/body_html_template_field.png
:width: 600
:alt: Body html template field

This configuration will enable this help text and also 3 context variables:

.. code-block:: python
{{unsubscribe_link_drip}} # Unsubscribe path for the current Drip
{{unsubscribe_link_campaign}} # Unsubscribe path for the Campaign (if exists)
{{unsubscribe_link}} # Unsubscribe path for all the emails
You will be free to use this context variables wherever it works for your email.
IMPORTANT: Please consider you will need to complete the HTTP Protocol and the domain you want to use, this context variables are RELATIVE PATHS.


Lookup fields
-------------
You can make queries using the User's model fields and the fields of the models related to the user.
For example, Groups model has 3 fields: `id`, `name`, and `id`. It will show you 4 items, these fields plus the groups relationship itself.
Another nice example is the SentDrip model, it has 8 fields but the drip field is also a relationship, so it will allow you to filter also over these fields in Drip model. This will allow you to filter Users that match a specific drip name sent to that user, using `sent_drips__drip__name` field.
Another nice example is the ``SentDrip`` model, it has 8 fields but the drip field is also a relationship, so it will allow you to filter also over these fields in Drip model. This will allow you to filter Users that match a specific drip name sent to that user, using `sent_drips__drip__name` field.
This will extend to any fields you have in your project related to User model.

.. image:: ../../images/users_lookup_fields.png
Expand Down
77 changes: 77 additions & 0 deletions docs/source/content/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,80 @@ In order to make this happen, the project's ``celery.py`` setup shall invoke the
`autodiscoverttasks <https://docs.celeryproject.org/en/latest/reference/celery.html#celery.Celery.autodiscover_tasks>`_
function. This task is scheduled with a simple
`Celery beat configuration <https://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#entries>`_.


Unsubscribe users from emails
-----------------------------

If you need to unsubscribe users from the emails please add the following key ``DRIP_UNSUBSCRIBE_USERS``set as ``True`` in the settings file.

We support unsubscribing from ``Drip``, ``Campaign``, and also all emails (all emails sent by this library).

To see more details about changes in Drip create, :ref:`click here <create-drip>`.

Another config is needed here, please add drip urls:


.. code-block:: python
urlpatterns = [
...,
path('drip_unsubscribe/', include('drip.urls'))
]
This configuration will enable 3 views (one for every type of unsubscription) with some dump HTML.


.. code-block:: python
class UnsubscribeDripView(TemplateView):
template_name = "unsubscribe_drip.html"
invalid_template_name = "unsubscribe_drip_invalid.html"
success_template_name = "unsubscribe_drip_success.html"
...
class UnsubscribeCampaignView(TemplateView):
template_name = "unsubscribe_campaign.html"
invalid_template_name = "unsubscribe_campaign_invalid.html"
success_template_name = "unsubscribe_campaign_success.html"
...
class UnsubscribeView(TemplateView):
template_name = "unsubscribe_general.html"
invalid_template_name = "unsubscribe_general_invalid.html"
success_template_name = "unsubscribe_general_success.html"
...
These dump views will be useful for development, if you wish to customize the HTML, please follow this example:


.. code-block:: python
from drip.views import UnsubscribeView
class CustomUnsubscribeView(UnsubscribeView):
template_name = "custom_template.html"
invalid_template_name = "invalid_custom_template.html"
success_template_name = "sucess_custom_template.html"
And then instead of adding the drip urls add the views you customize as the following:


.. code-block:: python
from django.urls import re_path
urlpatterns = [
...,
re_path(
r"^app/(?P<uidb64>\w+)/(?P<token>[\w-]+)/$",
CustomUnsubscribeView.as_view(),
name="unsubscribe_app",
),
]
Take a look in ``drip.urls`` file to understand how urls are build for all 3 views.
IMPORTANT: Please keep the views ``name`` with the same values.
9 changes: 9 additions & 0 deletions docs/source/drip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ drip.views module
:show-inheritance:


drip.tokens module
-----------------

.. automodule:: drip.tokens
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

Expand Down
2 changes: 1 addition & 1 deletion drip/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.15.3"
__version__ = "1.16.2"
Loading

0 comments on commit bdd2d0d

Please sign in to comment.