utils.py 文件源码

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

项目:tunga-api 作者: tunga-io 项目源码 文件源码
def channel_new_messages_annotation(user):
    """
    Queryset needs to annotated with channel_last_read for this to work
    :param user:
    :return:
    """
    return Sum(
        Case(
            When(
                ~Q(action_targets__actor_object_id=user.id) &
                Q(action_targets__gt=F('channel_last_read')) &
                Q(action_targets__verb__in=[verbs.SEND, verbs.UPLOAD]),
                then=1
            ),
            default=0,
            output_field=IntegerField()
        )
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号