admin.py 文件源码

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

项目:guifiadmin 作者: guifi-org 项目源码 文件源码
def needs_invoice(self, obj):
        if obj.last_invoice_date is None:
            return True
        date = now()
        if obj.quota_type.periodicity == obj.quota_type.ANUAL:
            start = make_aware(datetime.datetime(date.year, 1, 1), utc)
            return obj.last_invoice_date < start
        elif obj.quota_type.periodicity == obj.quota_type.ANUAL:
            if date.month == 12:
                year = date.year + 1
                month = 1
            else:
                year = date.year
                month = date.month + 1
            start = make_aware(datetime.datetime(year, month, 1), utc)
            return obj.last_invoice_date < start
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号