_commands.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:django-souvenirs 作者: appsembler 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号