Django - TypeError - save() got an unexpected keyword argument 'force_insert'

前端 未结 4 663
感动是毒
感动是毒 2020-12-03 04:41

Im new in Django and I can\'t figure out this error. Help please. It gave TypeError - save() got an unexpected keyword argument \'force_insert\'. I tested the code below and

4条回答
  •  [愿得一人]
    2020-12-03 05:40

    You've overridden the save method, but you haven't preserved its signature. Yo need to accept the same arguments as the original method, and pass them in when calling super.

    def save(self, *args, **kwargs):
        super().save((*args, **kwargs)
        ...
    

提交回复
热议问题