options.py 文件源码

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

项目:django-clubhouse 作者: chazmead 项目源码 文件源码
def get_block_type_queryset(self,db):
        qry = None
        for m in self.get_block_models():
            try:
                admin_url(m, 'add')
            except NoReverseMatch:
                continue

            q = models.Q(app_label=m._meta.app_label) & \
                models.Q(model=m._meta.object_name.lower())

            qry = qry | q if qry else q

        # If qry has not been set, i.e. no blocks extend the block_type, or
        # Blocks do not have an admin, then exclude all content types..
        return ContentType.objects.filter(qry).using(db) if qry else \
                ContentType.objects.exclude(pk__gte=0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号