worthwhile/django-herald

Templates From Database

deeplyfriedchicken opened this issue · 2 comments

I'm building an application that allows users to customize email templates before sending out messages to users.

Given that the docs only allow for specifying a directory for the email template, is there a way to utilize this library for pulling a template record directly from the database instead?

@kcunanan in principle yes, you can, but it's not supported out of the box atm with just some simple configs. You'd probably want to make a 1-to-1 relationship with the model to register the notification (https://github.com/worthwhile/django-herald/blob/master/herald/models.py#L81) and then from subclass the NotificationBase with custom logic in the render method (https://github.com/worthwhile/django-herald/blob/master/herald/base.py#L170) so that you can pull from that related table.

Thanks for the advice! We went with something similar in theory, I appreciate the help 👍