[Fixed]-Django update MySQL database issue involving foreign keys

1👍

You probably upgraded from some older Django version?
If so, note that now, when assigning foreign keys, you must assign a saved instance of the foreign object. If you want to just assign by id, then use <fieldname>_id

I believe, here,

fixtureUpdate = StraightredFixture(
    fixtureid=fixture['Id'],
    away_team_id=fixture['AwayTeam_Id'],
    home_team_id=fixture['HomeTeam_Id']
)

…should do the trick.

Leave a comment