Closed nklsw closed 3 years ago
Thanks for bringing this to our attention!
A few things of note: We are using get_template to render the templates. This will look through the DIRS listed in TEMPLATES of your settings file. You will need to specify in there where your templates are stored. Something like this:
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
# RIGHT HERE ▼
"DIRS": [os.path.join(BASE_DIR, 'templates')],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
}
This should fix the issue you're having. I also noticed that inside our django_notification_system.notification_creators.email.create_notification
function there was a small issue on line 76. The asterisks need to be removed.
email_body = template.render(**extra)
becomes
email_body = template.render(extra)
This has been patched and built if you pull the latest code, but if you're just playing around with it locally you can drop those two asterisks and everything should work fine.
Thanks @branks42, that solved the problem for me.
Keep up the good work! This is a very useful project.
I have not yet managed to include an email template via the
extra
dict.I am creating a Notification object like this:
The template HTML file is in the correct directory (also tried some random possibilities). If I specify only the
template_name
, it does not throw an error, but it also does not create a notification. If I specify other context values in theextra
dict , I get the following error:render() got an unexpected keyword argument 'someval'
Could you please provide an example of how to include templates?