Skip to content

Commit

Permalink
Merge remote-tracking branch 'sbook/feature/admin_styled_ses_stats'
Browse files Browse the repository at this point in the history
  • Loading branch information
hmarr committed Apr 16, 2011
2 parents 183473a + 633babf commit 3b1508b
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 77 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ A very simple read-only report on your quota, verified email addresses and
sending statistics is included.

If you wish to use the SES sending statistics reports, you must include
``django_ses`` in your INSTALLED_APPS and you must include ``django_ses.urls``
in your ``urls.py``.
``django.contrib.admin``(for templates) and ``django_ses`` in your
INSTALLED_APPSand you must include ``django_ses.urls`` in your ``urls.py``.

Django Management Command
=========================
Expand Down
182 changes: 107 additions & 75 deletions django_ses/templates/django_ses/send_stats.html
Original file line number Diff line number Diff line change
@@ -1,79 +1,111 @@
{% extends "base.html" %}
{% extends "admin/base_site.html" %}

{% block extrastyle %}
{{ block.super }}
<style>table {width: 100%;}</style>
{% endblock %}

{% block bodyclass %}dashboard{% endblock %}
{% block content_title %}<h1>SES Stats</h1>{% endblock %}

{% block content %}

<p>Access Key: <span id="aws_access_key_id">{{ access_key }}</span></p>
<table id="quota">
<thead>
<caption>Quotas</caption>
<tr>
<th>24 Quota</th>
<th>24 Sent</th>
<th>Quota Remaining</th>
<th>Per/s Quota</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ 24hour_quota }}<td>
<td>{{ 24hour_sent }}</td>
<td>{{ 24hour_remaining }}</td>
<td>{{ persecond_rate }}</td>
</tr>
</tbody>
</table>
<table id="sending_totals">
<thead>
<caption>Sending Totals</caption>
<tr>
<th>Delivery Attempts</th>
<th>Bounces</th>
<th>Complaints</th>
<th>Rejected</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ summary.DeliveryAttempts }}<td>
<td>{{ summary.Bounces }}</td>
<td>{{ summary.Complaints }}</td>
<td>{{ summary.Rejects }}</td>
</tr>
</tbody>
</table>
<table id="verified_emails">
<thead>
<caption>Verified Emails</caption>
<tr>
<th>Email Address</th>
</tr>
</thead>
<tbody>
{% for email_address in verified_emails %}
<tr>
<td>{{ email_address }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr><td><strong>{{ verified_emails|length }}</strong></td></tr>
</tfoot>
</table>
<table id="sending_stats">
<tr>
<th>Delivery Attempts</th>
<th>Bounces</th>
<th>Complaints</th>
<th>Rejected</th>
<th>Timestamp</th>
</tr>
{% for datapoint in datapoints %}
<tr>
<td>{{ datapoint.DeliveryAttempts }}</td>
<td>{{ datapoint.Bounces }}</td>
<td>{{ datapoint.Complaints }}</td>
<td>{{ datapoint.Rejects }}</td>
<td>{{ datapoint.Timestamp }}</td>
</tr>
{% endfor %}
</table>
<div id="content-main">
<div class="module">
<table id="quota">
<caption>Quotas</caption>
<thead>
<tr>
<th>24 Quota</th>
<th>24 Sent</th>
<th>Quota Remaining</th>
<th>Per/s Quota</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ 24hour_quota }}</td>
<td>{{ 24hour_sent }}</td>
<td>{{ 24hour_remaining }}</td>
<td>{{ persecond_rate }}</td>
</tr>
</tbody>
</table>
</div>

<div class="module">
<table id="sending_totals">
<caption>Sending Totals</caption>
<thead>
<tr>
<th>Delivery Attempts</th>
<th>Bounces</th>
<th>Complaints</th>
<th>Rejected</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ summary.DeliveryAttempts }}</td>
<td>{{ summary.Bounces }}</td>
<td>{{ summary.Complaints }}</td>
<td>{{ summary.Rejects }}</td>
</tr>
</tbody>
</table>
</div>

<div class="module">
<table id="sending_stats">
<caption>Verified Emails</caption>
<thead>
<tr>
<th>Delivery Attempts</th>
<th>Bounces</th>
<th>Complaints</th>
<th>Rejected</th>
<th>Timestamp</th>
</tr>
</thead>
<tbody>
{% for datapoint in datapoints %}
<tr>
<td>{{ datapoint.DeliveryAttempts }}</td>
<td>{{ datapoint.Bounces }}</td>
<td>{{ datapoint.Complaints }}</td>
<td>{{ datapoint.Rejects }}</td>
<td>{{ datapoint.Timestamp }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}


{% block sidebar %}
<div id="content-related">
<div class="module" id="recent-actions-module">
<h2>Verified Emails</h2>
<table id="verified_emails">
<thead>
<tr>
<th>Email Address</th>
</tr>
</thead>
<tbody>
{% for email_address in verified_emails %}
<tr>
<td>{{ email_address }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr><td><strong>{{ verified_emails|length }}</strong></td></tr>
</tfoot>
</table>
</div>
</div>
{% endblock %}
2 changes: 2 additions & 0 deletions django_ses/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def dashboard(request):
summary = sum_stats(ordered_data)

extra_context = {
'title': 'SES Statistics',
'datapoints': ordered_data,
'24hour_quota': quota['Max24HourSend'],
'24hour_sent': quota['SentLast24Hours'],
Expand All @@ -101,6 +102,7 @@ def dashboard(request):
'summary': summary,
'access_key': ses_conn.gs_access_key_id,
}

response = render_to_response(
'django_ses/send_stats.html',
extra_context,
Expand Down

0 comments on commit 3b1508b

Please sign in to comment.