TransactionManagementError “You can't execute queries until the end of the 'atomic' block” while using signals, but only during Unit Testing

后端 未结 11 2095
有刺的猬
有刺的猬 2020-12-02 06:03

I am getting TransactionManagementError when trying to save a Django User model instance and in its post_save signal, I\'m saving some models that have the user as the forei

11条回答
  •  旧时难觅i
    2020-12-02 06:24

    I had the same issue.

    In My Case I was doing this

    author.tasks.add(tasks)
    

    so converting it to

    author.tasks.add(*tasks)
    

    Removed that error.

提交回复
热议问题