1👍
✅
u.instrumentCategory = 1
That’s not how a models.ForeignKey
field works in Django. You need to get an instance of the Category
object and assign that to u.instrumentCategory
.
u.instrumentCategory = pmod.Category.objects.get(id=1)
Source:stackexchange.com