[Fixed]-Exception Value: Cannot assign "x": "y" must be a "z" instance

1👍

You can’t set a ForeignKey object as int. You can instead set the ForeignKey value (id associated with the FK object) by appending _id to the field:

fixtureUpdate = StraightredFixture(fixtureid=fixture['Id'],
                                   ...
                                   soccerseason_id = 1025)
#                                              ^^^

0👍

Try to replace soccerseason = 1025 with soccerseason_id = 1025. soccerseason is a relationship to StraightredSeason so you should provide an instance of it when trying to set this attribute.

Leave a comment