dimagi/rapidsms-logistics — pull request #6 by mlavin (2012-12-13 19:20:22+00:00)
Title: Email Report Summary

This adds a summary view for use in generating HTML email reports via the functionality in dimagi/email-reports. It currently does not make use of the configurable subject.

You would make use of this view by creating a `SchedulableReport` pointing to the view. You can view it on the web under `/logistics/email-summary` but I also tested the look in an email client by sending it to myself:

```
from django.contrib.auth.models import User
from email_reports.models import SchedulableReport, ReportSubscription

me = User.objects.get(username='mlavin')
defaults = {'display_name': ''}
report, _ = SchedulableReport.objects.get_or_create(
view_name='email-summary', report_type=SchedulableReport.TYPE_HTML,
defaults=defaults
)
subscription, _ = ReportSubscription.objects.get_or_create(report=report)
subscription.send_html_to_user(me)
```

This assumes there is a user named `mlavin` with a valid email address. This would obviously be replaced with your own username.

This work is based on ghana-dev and the request is to merge back into ghana-dev and relates to FB45947. If this is functionality that would be useful to other deployments I rebase the branch onto dev or master and create different pull request.

Feedback is always welcome. CC @rowenaluk.