Kesalahan kunci asing Django tidak dapat ditetapkan harus menjadi contoh

# This error is because you're trying to assign an instance.id instead of 
# the instance itself. If its a foreign key field you assigned the instance i.e.
yourTable.yourCol = relatedTable.objects.get(relatedTableColumn = yourColValue)
#-or-
Orders.Dept_id = Department.objects.get(id = yourValueHere)
Orders.save()
Trained Tuna