你应该使用
super
类作为第一个参数来调用
UrlManager
,而不是使用
URL
模型。替换代码0】不能用一个
不相关的
类别/类型。
From the docs,
super(type[, object-or-type])
:
返回一个代理对象,该对象将方法调用委托给一个父类或
类型的父类或同级类。
So you
不能
do:
>>> class D:
... pass
>>> class C:
... def __init__(self):
... super(D, self).__init__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __init__
TypeError: super(type, obj): obj must be an instance or subtype of type
You should do:
qs_main = super(UrlManager, self).all(*args, **kwargs)
Or in Python 3:
qs_main = super().all(*args, **kwargs)