[Answer]-Creating multiple database entries out of an archive of files using a form in Django

1👍

I’m pretty sure the line:

new_model = formtoaddpart.save(commit=False)

doesn’t return a new python instance of the model class.

Your best bet would be to output the newmodel.pk in the loop and see if it changes.

From experience, I know that if you want to edit an existing instance and save it as a new one, you can just do newmodel.pk = None and Django will create a new instance.

Leave a comment