Reputation: 971
I have the following MySQL database table:
+---------------------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------+-------------+------+-----+---------+-------+
| fixtureid | int(11) | NO | PRI | NULL | |
| fixturedate | datetime | YES | | NULL | |
I wish to pull in some data from an xmlsoccer.com website but it is returned in the following format "2015-08-01T11:45:00+00:00".
When I try to import it I get the following error:
Exception Type: ValueError Exception Value: MySQL backend does not support timezone-aware datetimes when USE_TZ is False.
My django code is as follows:
fixtureUpdate = StraightredFixture(fixtureid=fixture['Id'],
away_team_id = fixture['AwayTeam_Id'],
home_team_id = fixture['HomeTeam_Id'],
fixturedate = fixture['Date'])
fixtureUpdate.save()
If anyone could point me in the right direction to make the date MySQL friendly that would be great. Many thanks, Alan
Upvotes: 1
Views: 1404
Reputation: 14535
As an error message points out you should either:
USE_TZ = True
Upvotes: 1