Answer the question
In order to leave comments, you need to log in
When creating through objects.create(), an IntegrityError is thrown. How to fix?
There is a code:
o = Foo.objects.create(date=date.today())
o.save()
class Foo(models.Model):
date = models.DateField(verbose_name='Дата создания', blank=False)
Exception Type: IntegrityError
Exception Value:
UNIQUE constraint failed: foos_foos.id
Answer the question
In order to leave comments, you need to log in
Looks strange. Are there any objects in table Foo ? What if we delete the table and create it again? What DBMS?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question