{"action":"created","issue":{"url":"https://api.github.com/repos/owocki/pytrader/issues/69","repository_url":"https://api.github.com/repos/owocki/pytrader","labels_url":"https://api.github.com/repos/owocki/pytrader/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/owocki/pytrader/issues/69/comments","events_url":"https://api.github.com/repos/owocki/pytrader/issues/69/events","html_url":"https://github.com/owocki/pytrader/pull/69","id":147118505,"number":69,"title":"Use UTC datetimes everywhere","user":{"login":"rubik","id":238549,"avatar_url":"https://avatars.githubusercontent.com/u/238549?v=3","gravatar_id":"","url":"https://api.github.com/users/rubik","html_url":"https://github.com/rubik","followers_url":"https://api.github.com/users/rubik/followers","following_url":"https://api.github.com/users/rubik/following{/other_user}","gists_url":"https://api.github.com/users/rubik/gists{/gist_id}","starred_url":"https://api.github.com/users/rubik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubik/subscriptions","organizations_url":"https://api.github.com/users/rubik/orgs","repos_url":"https://api.github.com/users/rubik/repos","events_url":"https://api.github.com/users/rubik/events{/privacy}","received_events_url":"https://api.github.com/users/rubik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-04-09T10:47:40Z","updated_at":"2016-04-14T13:49:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/owocki/pytrader/pulls/69","html_url":"https://github.com/owocki/pytrader/pull/69","diff_url":"https://github.com/owocki/pytrader/pull/69.diff","patch_url":"https://github.com/owocki/pytrader/pull/69.patch"},"body":"## What changed\r\n* All datetime math is now done in UTC. `DateTimeField`s are guaranteed to be already UTC since when `USE_TZ = True` Django will set PostgreSQL's [timezone config option](http://www.postgresql.org/docs/9.5/static/runtime-config-client.html#GUC-TIMEZONE) to UTC, as explained here:\r\nhttps://docs.djangoproject.com/en/1.9/ref/databases/#optimizing-postgresql-s-configuration;\r\n* `created_on` and `modified_on` do not rely anymore on `get_time`, everything is done automatically with `auto_now=True` and `auto_now_add=True`. Those two options use internally `timezone.now()`;\r\n* a new migration has been generated to alter the aforementioned fields;\r\n* `created_on_str` is now saved in UTC. In this way the DB is not tied to a specific timezone. However, it's still not perfect, since the old data is still in MST and a migration could be necessary. Ideally though, we should be able to get rid of `created_on_str` altogether and find a way to make chartit work. I have not investigated further, but maybe a property that computes the value on the fly could do it. There are performance implications though;\r\n* many lines were updated due to trailing space. My editor removes it automatically on save.\r\n\r\n## Migration\r\nSince PostgreSQL stores all the datetimes as UTC, no DB migration is required. However, some Django fields have been altered, so a `python manage.py migrate` is necessary to get things working.\r\n\r\n## Notes\r\n`created_on` and `modified_on` are no longer shown in the admin. This is due to the fact that those two attributes are now managed automatically by Django.\r\n\r\nFor reference, see #9."},"comment":{"url":"https://api.github.com/repos/owocki/pytrader/issues/comments/209951619","html_url":"https://github.com/owocki/pytrader/pull/69#issuecomment-209951619","issue_url":"https://api.github.com/repos/owocki/pytrader/issues/69","id":209951619,"user":{"login":"owocki","id":513929,"avatar_url":"https://avatars.githubusercontent.com/u/513929?v=3","gravatar_id":"","url":"https://api.github.com/users/owocki","html_url":"https://github.com/owocki","followers_url":"https://api.github.com/users/owocki/followers","following_url":"https://api.github.com/users/owocki/following{/other_user}","gists_url":"https://api.github.com/users/owocki/gists{/gist_id}","starred_url":"https://api.github.com/users/owocki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owocki/subscriptions","organizations_url":"https://api.github.com/users/owocki/orgs","repos_url":"https://api.github.com/users/owocki/repos","events_url":"https://api.github.com/users/owocki/events{/privacy}","received_events_url":"https://api.github.com/users/owocki/received_events","type":"User","site_admin":false},"created_at":"2016-04-14T13:49:11Z","updated_at":"2016-04-14T13:49:11Z","body":"this will need a rebase before merging."}}