__init__.py 文件源码

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

项目:django-querysetsequence 作者: percipient 项目源码 文件源码
def __init__(self, *args):
        self._querysets = list(args)
        # Mark each QuerySet's Model with the number of the QuerySet it is.
        for i, qs in enumerate(self._querysets):
            # Generate a Proxy model and then modify that to allow for the same
            # Model to be used in multiple QuerySetSequences at once.
            qs.model = self._get_model(qs.model)
            # Also push this to the Query object since that holds it's own
            # reference to QuerySet.model instead of asking the QuerySet for it.
            qs.query.model = qs.model

            # Actually set the attribute.
            setattr(qs.model, '#', i)

        # Call super to pick up a variety of properties.
        super(QuerySequence, self).__init__(model=None)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号