def usage_this_week(self):
""" All usage since midnight on Monday """
today = timezone.now().replace(hour=0, minute=0, second=0)
last_monday = today + relativedelta(weekday=MO(-1))
return self.usage.filter(start__gt=last_monday).count()
评论列表
文章目录