models.py 文件源码

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

项目:closedverse 作者: ariankordi 项目源码 文件源码
def limit_remaining(self):
        limit = self.profile('limit_post')
        # If False is returned, no post limit is assumed.
        if limit == 0:
            return False
        today_min = timezone.datetime.combine(timezone.datetime.today(), time.min)
        today_max = timezone.datetime.combine(timezone.datetime.today(), time.max)
        # recent_posts =
        # Posts made by the user today + posts made by the IP today +
        # same thing except with comments
        recent_posts = Post.real.filter(Q(creator=self.id, created__range=(today_min, today_max)) | Q(creator__addr=self.addr, created__range=(today_min, today_max))).count() + Comment.real.filter(Q(creator=self.id, created__range=(today_min, today_max)) | Q(creator__addr=self.addr, created__range=(today_min, today_max))).count()

        # Posts remaining
        return int(limit) - recent_posts
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号