我想为我的 PyMODM 类提供一个自定义初始化程序。以直接的方式进行
class MyModel(MongoModel):
fields = ...
def __init__(self, other_args...):
super().__init__(other_args)
do_something_else()
首先产生一个警告:
DeprecationWarning: __class__ not set defining 'MyModel' as <class '__main__.MyModel'>. Was __classcell__ propagated to type.__new__?
然后是一个错误:
TypeError: __init__() missing required positional arguments
我错过了什么?