Replies: 1 comment 2 replies
-
Hello @RNCTX , thank you for showing us these features. We will try to implement them in the future. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I'm glad someone has taken up an "official" fork of the original django-drip project, it's still quite useful.
I forked it myself awhile back from, in turn, another fork that had taken up Python 3.x compatibility and added a few basic features for a non-profit's implementation last year. They were using Wagtail so note there are two branches in this repo, one for Django stock and one for Wagtail.
https://github.com/RNCTX/django-drip
I implemented a couple of extra bits of functionality that I think you guys should think about doing as well.
1. Unsubscribe one-time links
One obvious feature missing from the original drip project was unsubscribe links. Since the bulk of the usage for such a component as this will be marketing email, one-click unsubscribe links are necessary for regulatory and email relay service policy compliance. I implemented this using django's internal password-reset token generating function,
PasswordResetTokenGenerator
, run against the UID, a timestamp of the email being sent, and the user's subscription status.I then integrated it into django-drip by manually adding it to the template context object via
{{ unsubscribe }}
, like so...RNCTX/django-drip@0358b02
Then a simple matter of providing an unsubscribe view/template page that checks the token and returns either a success template or a failure (invalid token) template, and a function
unsubscribe_token
that generates a django email password reset token with the django password reset link generator functions included in the base, and checks the validity of said tokens...Along with a urls.py of:
This results in a sufficiently obscure one-time link such as...
https://url.domain.net/unsubscribe/cm9iZXJ0bmNsYXl0b25AZ21haWwuY29t/5ep-c908e346ac45558f9eed/
As you can surmise from the above the org was using a modified user model that replaced integer UIDs with email UIDs and email logins. All of this obviously entails modifying the default user model as a requirement, to add a "subscribed" boolean field of either true or false. I implemented this in the drip context by modifying the default modeladmin for the drip UI in the django/wagtail admin panels to always provide "user.subscribed" = "True" as the first condition to any drip template they might create like so:
RNCTX/django-drip@2e3d050#diff-4bd8c971fa717dbf4acb76dd2e24893ca8e03afd59caa558040235ff4ccccf7d
...and adding the
https://{{ unsubscribe }}
dynamically generated context link to their base drip email template, like so (beginning on line 130 at the bottom):RNCTX/django-drip@8ba7f4b#diff-4bd8c971fa717dbf4acb76dd2e24893ca8e03afd59caa558040235ff4ccccf7d
2. Emailing to groups of users as a drip target
Django does not provide anything in the base functionality to my knowledge that allows emailing to a group of users, which is unfortunate considering django does come with group permissions out of the box. To facilitate targeting emails to groups of users for the organization I implemented this for (not necessarily just drips, but all email), I modified their django-post-office installation to loop over users in a group at send time:
RNCTX/django-post_office@1aa4464
I know this is getting out of the scope of this fork by including another project, in my case the org wanted the ability to send emails to groups of staff outside of the context of drips as well. But it might be possible to subclass the Django "mail" functions/classes and maintain compatibility with replacement mailers such as django-post-office which provide identical functionality, although I didn't look into that rather than just modifying the mailer in my case, which was the quicker/dirtier/easier solution.
At the very least, a one-click query button to "only target a specific group with this drip" which helped the admin user make a drip that only worked on one group of users would be useful, since the default Django user/group implementation invites people to make use of groups, and create new groups to drop user signups into (like "customers" or "donors" or "subscribers" or "loyalty_program_members" or other such obvious marketing groups).
Beta Was this translation helpful? Give feedback.
All reactions