Skip to main content

Django library to send ‘report’ mail.

Almost django management commands used as night batch processing, and then, administrators will want to know the result of it as mail.

At a glance

Consider a case which is for processing lines of csv by django’s management command. And then you want to know the result of the command by mail.

Just thing you should do is decorating handle method by apply_reporter method:

import csv
from django.core.management.base import BaseCommand

from reportmail.command import apply_reporter

class Command(BaseCommand):
    @apply_reporter("Title")
    def handle(self, reporter, filepath, *args, **options):
        for i, l in enumerate(csv.DictReader(open(filepath))):
            reporter.append('Line {}: processed {}'.format(i+1, l))

Then, when the command finish, you’ll get a admin mail like this:

Subject:
    Title
Body:
    Report of someapp.management.commands.some_of_your_command
    args: path/to/somecsv.csv
    options: settings=None,pythonpath=None,traceback=None,verbosity=1,

    result:
    Line1: processed {'somefield': 'somevalue0'}
    Line2: processed {'somefield': 'somevalue1'}
    Line3: processed {'somefield': 'somevalue2'}
    Line4: processed {'somefield': 'somevalue3'}
    ...

If you like django-reportmail, please refer the documentation. You can learn about django-reportmail enough to use it on your work.

Resources

Changes

1.3 (2015-08-20)

#6 Added .abort() feature for Reporter.

1.2.4 (2014-11-29)

#5 Officially supporting for Python3.4 and Django1.7.

1.2.3 (2014-06-20)

#3 Add manager_mail_committer.

1.2.2 (2014-06-15)

#2 Improved apply_reporter to get a committer function.

1.2.1 (2014-06-14)

Cleaned up the default template of report mail.

1.2 (2014-06-07)

  • Fixed wrong function names of committer (comitter => committer)

    • reportmail.reporter.console_comitter is now renamed as reportmail.reporter.console_committer

    • reportmail.reporter.admin_mail_comitter is now renamed as reportmail.reporter.admin_mail_committer

1.1 (2014-05-28)

  • Fixed the wrong attribute name of Reporter (comitter => committer)

1.0 (2014-05-28)

Initial release

Metadata

Release files for django-reportmail 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-reportmail 1.3
File Size Uploaded
django-reportmail-1.3.tar.gz 6.3 kB Details

Release files / django-reportmail-1.3.tar.gz

Download URL django-reportmail-1.3.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
90e905e8fe8c108d956d92ad6b7b293a24014f5e2453955cd4fcbd7ad591e5c8
BLAKE2b-256 checksum
How to use checksums
456e8b5819cdaf43460598eb81b1a9b970afb5c83920c50e7bc2cfbcba1dad41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.3 This release

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page