def handle(self, *args, **options):
report = options['report'] or 'monthly'
if (report in ['daily', 'monthly', 'quarterly', 'yearly'] and
options['subscription_start'] is None
):
raise CommandError("{} report requires --subscription-start"
.format(report))
report_method = getattr(self, '{}_report'.format(report))
headers, rows = report_method(options)
if options['recent']:
rows = rows[-options['recent']:]
# reports are chronologically ascending by default (mainly because of
# enumerations), but for display we prefer reversed by default.
if not options['ascending']:
rows = reversed(rows)
return headers, rows
评论列表
文章目录