Django : get_or_create Raises duplicate entry with together_unique

前端 未结 1 1286
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 02:56

model example

class Example(Stat):
    numeric = models.IntegerField(...) 
    date = models.DateField( auto_now_add=True,...) #auto_now_add=True was the pro         


        
相关标签:
1条回答
  • 2020-12-29 03:34

    It appears your problem is with there being more columns you're not including in your get_or_create, see i.e. this thread on a Django mailing list.

    You need to use the defaults parameter of get_or_create as described in the docs, or specify values for all columns, for get_or_create to match correctly.

    0 讨论(0)
提交回复
热议问题