把自己在使用Django过程中吃过的亏 踩过的坑 记录一下

1. unique_together传的是元组

正确:unique_together = ((‘app_id', 'module_id', 'caseid'))

错误:unique_together = (‘app_id', 'module_id', 'caseid')

2.order_by穿的是字符串

正确:Case.objects.filter(**search_dict).order('id')

错误:Case.objects.filter(**search_dict).order(id)

相关文章:

  • 2022-12-23
  • 2022-02-19
  • 2021-11-30
  • 2021-08-30
  • 2022-12-23
  • 2021-07-30
  • 2021-11-02
  • 2021-07-28
猜你喜欢
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2021-08-14
  • 2021-08-18
  • 2021-09-22
  • 2021-04-24
相关资源
相似解决方案