luyangyun

官方使用示例:

1 obj, created = Person.objects.update_or_create(
2     first_name='John', last_name='Lennon',
3     defaults={'first_name': 'Bob'},
4 )

 

当update_or_create的查询结果大于1个时,那么就会报错MultipleObjectsReturned的错。

纠正方式就是尽可能的缩小查询范围,实在无法确认,那就老老实实的使用先判断是否存在再进行更新。

 

关键报错信息:

MultipleObjectsReturned: get() returned more than one CheckConfigCheckStandardTable -- it returned 3!

 

 

posted on 2018-03-28 23:15 luyangyun 阅读(...) 评论(...) 编辑 收藏

相关文章:

  • 2021-10-09
  • 2021-06-09
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2021-08-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
相关资源
相似解决方案