Question

I'm attempting use django-notification to send an email to the admin every time a user modifies, creates or deletes a database entry. The issue is, while I have created the notice types and confirm they exist, when the actual email is sent, the email sent looks like this:

You have received the following notice from example.com:

Entry has been changed. <--- this line being the email content


To see other notices or change how you receive notifications, please go to http://example.com

Is there a way to remove the first and last lines of that email body? I don't know where this default template is located so I can't change it. Any insight would be greatly appreciated!

Was it helpful?

Solution

You should locate the default installation directory for pip. If you use Linux it should be something like /usr/local/lib/python2.7/dist-packages if you use python2.7. Then locate the django-notification directory and change to the templates directory. And here they are!

A good idea is to copy the application to your project directory and change it here.

I simply suggest you take a look at virtualenv which will give you more flexibility for such forks.

OTHER TIPS

Changing system libraries are not a good idea. You can do this from your app:

1) Put the notification app below your app in settings.py

 INSTALLED_APPS = (
      # ...
      'your_app',
      'notification',
      # ...
 )

2) Create the set of base templates in your_app/templates/notification/ directory:

  • short.txt
  • notice_settings.html
  • notice.html
  • full.txt
  • full.html
  • email_subject.txt
  • email_body.txt
  • base.html
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top