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)
评论列表
文章目录