Django: get_or_create Создает повторяющуюся запись с классом примера модели together_unique

пример модели

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

    class Meta:
       unique_together = ('numeric','date')

)

Если 72 и '2011-08-07' уже сохранены

Example.object.get_or_create(numeric=72,date='2011-08-07')

, возникает

django.db.utils.IntegrityError: (1062, "Duplicate entry '72-2011-08-07'

вопрос, почему get_or_create вызывает IntegrityError , это идея использования get_or_create .

Не уверен, что это ошибка, я открыл заявку https://code.djangoproject.com/ticket/16587

28
задан agf 27 September 2011 в 07:41
поделиться