Reputation: 95
I'm using Django-models for saving data to database but I have a problem,
a new record has an incorrect id (I need to save some records in a for
loop)
My error:
IntegrityError: (1062, u"Duplicate entry '46' for key 'PRIMARY'")
The view:
Upvotes: 3
Views: 128
Reputation: 7402
try to put subject
in for loop statment, i think you need to create new subject object every time when need to save different subjects
i in range(len(SUBJECTS)):
subject = Subjects()
...
subject.save()
Upvotes: 1