{"action":"opened","number":7134,"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/7134","id":82114528,"html_url":"https://github.com/django/django/pull/7134","diff_url":"https://github.com/django/django/pull/7134.diff","patch_url":"https://github.com/django/django/pull/7134.patch","issue_url":"https://api.github.com/repos/django/django/issues/7134","number":7134,"state":"open","locked":false,"title":"Fixed #25181 -- Moved views.generic.dates.timezone_today() to utils.timezone.localdate()","user":{"login":"jdufresne","id":347634,"avatar_url":"https://avatars.githubusercontent.com/u/347634?v=3","gravatar_id":"","url":"https://api.github.com/users/jdufresne","html_url":"https://github.com/jdufresne","followers_url":"https://api.github.com/users/jdufresne/followers","following_url":"https://api.github.com/users/jdufresne/following{/other_user}","gists_url":"https://api.github.com/users/jdufresne/gists{/gist_id}","starred_url":"https://api.github.com/users/jdufresne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdufresne/subscriptions","organizations_url":"https://api.github.com/users/jdufresne/orgs","repos_url":"https://api.github.com/users/jdufresne/repos","events_url":"https://api.github.com/users/jdufresne/events{/privacy}","received_events_url":"https://api.github.com/users/jdufresne/received_events","type":"User","site_admin":false},"body":"Thanks @kswiat for the original [PR](https://github.com/django/django/pull/5055).\r\n\r\n<https://code.djangoproject.com/ticket/25181>\r\n\r\nSome response to other tickets and PRs:\r\n\r\nFrom @aaugustin \r\n\r\n> It may be useful to make these functions fallback reasonably when `USE_TZ` is `False` for the benefit of pluggable applications. In that case, `localtime()` should return:\r\n> \r\n> ...\r\n> 3. (probably) an exception if `value` is provided and it is aware\r\n\r\nAdding the following guard to `localtime()` produces a [few test failures](http://dpaste.com/2S6RD55). It looks like there is an existing assumption that `localtime()` works on aware datetimes regardless of the value `USE_TZ`. I'm open towards moving in the suggested direction, but it may be more invasive than originally thought and have backwards compatibility concerns. What are you thoughts?\r\n\r\nGuard: \r\n\r\n```python\r\nif not settings.USE_TZ and is_aware(value):\r\n    raise ValueError(\"Cannot call localtime() with an aware datetime when USE_TZ is False\")\r\n```\r\n\r\n---\r\n\r\nIf agreeable, I would also like to add an analogous function to return `datetime.time()` in the current time zone. (Obviously, the name `localtime()` won't work.) I think it would be just as useful as `localdate()` for the same reasons. IME, just the current TZ's time is frequently  important to display to the user or compare to other values. Having an official, documented convenience function that gets this right and is reusable across applications seems beneficial to me. However, @aaugustin didn't give it the same \"+0\" as `localdate()` in ticket [#27082](https://code.djangoproject.com/ticket/27082). So I'm looking for feedback.\r\n\r\nThanks!","created_at":"2016-08-21T19:35:38Z","updated_at":"2016-08-21T19:35:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/7134/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/7134/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/7134/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/36567add17ddb40e08343b7ecdb25d9e84b433a1","head":{"label":"jdufresne:timezone-today","ref":"timezone-today","sha":"36567add17ddb40e08343b7ecdb25d9e84b433a1","user":{"login":"jdufresne","id":347634,"avatar_url":"https://avatars.githubusercontent.com/u/347634?v=3","gravatar_id":"","url":"https://api.github.com/users/jdufresne","html_url":"https://github.com/jdufresne","followers_url":"https://api.github.com/users/jdufresne/followers","following_url":"https://api.github.com/users/jdufresne/following{/other_user}","gists_url":"https://api.github.com/users/jdufresne/gists{/gist_id}","starred_url":"https://api.github.com/users/jdufresne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdufresne/subscriptions","organizations_url":"https://api.github.com/users/jdufresne/orgs","repos_url":"https://api.github.com/users/jdufresne/repos","events_url":"https://api.github.com/users/jdufresne/events{/privacy}","received_events_url":"https://api.github.com/users/jdufresne/received_events","type":"User","site_admin":false},"repo":{"id":23339499,"name":"django","full_name":"jdufresne/django","owner":{"login":"jdufresne","id":347634,"avatar_url":"https://avatars.githubusercontent.com/u/347634?v=3","gravatar_id":"","url":"https://api.github.com/users/jdufresne","html_url":"https://github.com/jdufresne","followers_url":"https://api.github.com/users/jdufresne/followers","following_url":"https://api.github.com/users/jdufresne/following{/other_user}","gists_url":"https://api.github.com/users/jdufresne/gists{/gist_id}","starred_url":"https://api.github.com/users/jdufresne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdufresne/subscriptions","organizations_url":"https://api.github.com/users/jdufresne/orgs","repos_url":"https://api.github.com/users/jdufresne/repos","events_url":"https://api.github.com/users/jdufresne/events{/privacy}","received_events_url":"https://api.github.com/users/jdufresne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdufresne/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/jdufresne/django","forks_url":"https://api.github.com/repos/jdufresne/django/forks","keys_url":"https://api.github.com/repos/jdufresne/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdufresne/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdufresne/django/teams","hooks_url":"https://api.github.com/repos/jdufresne/django/hooks","issue_events_url":"https://api.github.com/repos/jdufresne/django/issues/events{/number}","events_url":"https://api.github.com/repos/jdufresne/django/events","assignees_url":"https://api.github.com/repos/jdufresne/django/assignees{/user}","branches_url":"https://api.github.com/repos/jdufresne/django/branches{/branch}","tags_url":"https://api.github.com/repos/jdufresne/django/tags","blobs_url":"https://api.github.com/repos/jdufresne/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdufresne/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdufresne/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdufresne/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdufresne/django/statuses/{sha}","languages_url":"https://api.github.com/repos/jdufresne/django/languages","stargazers_url":"https://api.github.com/repos/jdufresne/django/stargazers","contributors_url":"https://api.github.com/repos/jdufresne/django/contributors","subscribers_url":"https://api.github.com/repos/jdufresne/django/subscribers","subscription_url":"https://api.github.com/repos/jdufresne/django/subscription","commits_url":"https://api.github.com/repos/jdufresne/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdufresne/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdufresne/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdufresne/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdufresne/django/contents/{+path}","compare_url":"https://api.github.com/repos/jdufresne/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdufresne/django/merges","archive_url":"https://api.github.com/repos/jdufresne/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdufresne/django/downloads","issues_url":"https://api.github.com/repos/jdufresne/django/issues{/number}","pulls_url":"https://api.github.com/repos/jdufresne/django/pulls{/number}","milestones_url":"https://api.github.com/repos/jdufresne/django/milestones{/number}","notifications_url":"https://api.github.com/repos/jdufresne/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdufresne/django/labels{/name}","releases_url":"https://api.github.com/repos/jdufresne/django/releases{/id}","deployments_url":"https://api.github.com/repos/jdufresne/django/deployments","created_at":"2014-08-26T05:11:10Z","updated_at":"2016-02-10T00:56:50Z","pushed_at":"2016-08-21T19:13:07Z","git_url":"git://github.com/jdufresne/django.git","ssh_url":"git@github.com:jdufresne/django.git","clone_url":"https://github.com/jdufresne/django.git","svn_url":"https://github.com/jdufresne/django","homepage":"https://www.djangoproject.com/","size":133104,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"bc1e2d8e8edde6cc7d2657c68242a13ee65a15b8","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","deployments_url":"https://api.github.com/repos/django/django/deployments","created_at":"2012-04-28T02:47:18Z","updated_at":"2016-08-21T19:26:15Z","pushed_at":"2016-08-21T19:35:38Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":196399,"stargazers_count":20841,"watchers_count":20841,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8416,"mirror_url":null,"open_issues_count":106,"forks":8416,"open_issues":106,"watchers":20841,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/7134"},"html":{"href":"https://github.com/django/django/pull/7134"},"issue":{"href":"https://api.github.com/repos/django/django/issues/7134"},"comments":{"href":"https://api.github.com/repos/django/django/issues/7134/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/7134/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/7134/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/36567add17ddb40e08343b7ecdb25d9e84b433a1"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":134,"deletions":18,"changed_files":6}}
{"actor":{"display_login":"jdufresne"}}