-
Notifications
You must be signed in to change notification settings - Fork 138
Decoupling email templates from drip #8
Comments
Interesting. What are the major benefits of using |
Yeah, it could just be us, that's a decent solution, but it could get annoying to not easily be able to search all templates and edit them all at the same time in something like vi, though I do understand that not all companies have content creators that know enough and are trusted enough to be able to play around in the codebase without breaking anything. Also, I don't know if automatically converting html -> text rather than the other way around, or better, explicitly defining both, is the right way to go. The issue being if you want to have |
Good call on the link bit, I'll open an issue on that (opened issue #9). |
I've got a similar customization need in a closely-related area: in my case I need to be able to customize the email class that is used for creating the email message. (For specifics, I'm trying in integrate use of django-drip with https://github.com/brack3t/Djrill, and in order to take advantage of any Mandrill stuff I need drip to build emails that are DjrillMessage instances rather than EmailMultiAlternatives). I was thinking of possibly proposing an ability to specify a custom class to use instead of EmailMultiAlternative, but seeing this request for template decoupling I wonder if one point of customization could serve both these needs. What would you think of an approach that involved factoring out much of what build_email does into an independent class (which would be the default class used by django-drip, but could be overridden via settings). This class would be handed the user and drip instances, and would have methods to retrieve context (maybe?), subject, (html) body, plain text version, and to retrieve the email message instance with a send() method. build_email could then just defer to this class for the specifics of the email that is created, and users could customize the email content by subclassing the default class and overriding any of the methods where they need behavior different than default. build_email would still be responsible for doing the SentDrip creation and calling send() on the retrieved email instance, if necessary. |
Closed the PR associated, sorry for the silence for so long! Please reopen or make a new issue w/ reference if we want to continue the convo here! |
What do you guys think about allowing third party email content compilers to be used?
We currently use https://github.com/bradwhittington/django-templated-email for sending emails which is great (basically, you define the email in a django template file which can extend other templates, and send the email by referencing the template's filename).
The issue is it would make the easiest case harder probably, unless optional
subject_template
andbody_html_template
fields are left in theDrip
model.Other, less wasteful (no optional
TextField
s) options:OneToOneField
from a new modelDripEmailTemplate
toDrip
and add it as an Inline to the Drip admin in addition to an optional "template_name" field to send todjango-templated-email
.DripEmailTemplate
could be referenced from a optionalForeignKey
inDrip
which would allow you to have multipleDrip
s use the sameDripEmailTemplate
I'd be willing to take on this project but wanted to see if I could get it to work for more than just us.
The text was updated successfully, but these errors were encountered: