Simple daily summary email with charts.
MIT License
Simple daily summary email with charts. Built using the awesome charting library leather and CairoSVG to convert the SVGs to PNGs for emails.
pip install daily_digest
settings.py
INSTALLED_APPS = [
'daily_digest',
]
settings.py
file.DAILY_DIGEST_CONFIG = {
'title': 'Daily Digest',
'from_email': '[email protected]', # defaults as settings.DEFAULT_FROM_EMAIL
'to': ['[email protected]'],
'timezone': 'America/Los_Angeles', # timezone for chart data (default UTC)
'exclude_today': False, # include the current day the email is sent in the chart (default False)
'charts': [
{
'title': 'New Users',
'model': 'django.contrib.auth.models.User',
'date_field': 'date_joined', # used to count per day
'filter_kwargs': {
'is_active': True
}
},
{
'title': 'Photo Uploads',
'model': 'project.photos.models.PhotoUpload',
'date_field': 'created'
},
]
}
Set a scheduled job to run this once a day. The email will be sent to all addresses in DAILY_DIGEST_CONFIG['to']
.
python manage.py send_daily_digest
Add the following to your projects urls.py
from django.conf.urls import include
urlpatterns = [
url(r'^', include('daily_digest.urls')),
]
Visit /admin/daily-digest-preview/ to see a preview. This page requires the user has admin privileges.
mkvirtualenv --python=python3 daily-digest
pip install -r requirements.txt
Why isn't python2.7 supported?
The dependency
CairoSVG
doesn't support anything below python3.4.
Why is the leather project included?
Upstream
leather
doesn't yet have the ability to show a dashed line. I have a PR for the change in review so in the meantime I am including the fork. Thedependency_links
feature of pip has a deprecation warning and the feature will be removed soon so currently the only option I am aware of is to include the code.