Skip to content Skip to sidebar Skip to footer

How To Solve Multipleobjectsreturned With Foreignkeywidget In Django-import-export

I have a resource that should help me import data into my model but it doesn't work. I have tried all the options I could but to no success. This is the resource. class ImportStude

Solution 1:

You are violating the ForeignKey constraint with class (klass) (and also stream) row

Jaq / class2
Lucy / class2# only 1 can have 2 as its a ForeignKey# same error will happen in stream row 4 Eagle 2 Hawk

You should insted of Foreignkey use a ManyToMany field

documentation: https://docs.djangoproject.com/en/3.2/ref/models/fields/#manytomanyfield

Post a Comment for "How To Solve Multipleobjectsreturned With Foreignkeywidget In Django-import-export"