{"action":"created","comment":{"url":"https://api.github.com/repos/mirumee/saleor/pulls/comments/170621254","pull_request_review_id":99322746,"id":170621254,"diff_hunk":"@@ -0,0 +1,47 @@\n+import datetime\n+\n+from django.core.validators import validate_slug\n+from django.db import models\n+from django.db.models import Q\n+from django.urls import reverse\n+\n+\n+class PageManager(models.QuerySet):\n+    def public(self):\n+        today = datetime.date.today()\n+        return self.filter(\n+            Q(visible=True),\n+            Q(available_on__lte=today) | Q(available_on__isnull=True))\n+\n+    def get_available(self, allow_draft=False):\n+        if not allow_draft:\n+            return self.public()\n+        return self\n+\n+\n+class Page(models.Model):\n+    url = models.CharField(\n+        max_length=100, db_index=True, validators=[validate_slug])\n+    title = models.CharField(max_length=200)\n+    content = models.TextField()\n+    created = models.DateTimeField(auto_now_add=True)\n+    visible = models.BooleanField(default=False)\n+    available_on = models.DateField(blank=True, null=True)\n+\n+    objects = PageManager.as_manager()\n+\n+    class Meta:\n+        ordering = ('url',)\n+\n+    def __str__(self):\n+        return self.title\n+\n+    def get_absolute_url(self):\n+        return reverse('page:details', kwargs={'url': self.url})\n+\n+    def save(self, *args, **kwargs):\n+        \"\"\"\n+        Make sure url is not being written to database with uppercase.\n+        \"\"\"\n+        self.url = self.url.lower()","path":"saleor/page/models.py","position":46,"original_position":46,"commit_id":"c82d6eee0268806e7437ce574a35de644b99b77d","original_commit_id":"c82d6eee0268806e7437ce574a35de644b99b77d","user":{"login":"elwoodxblues","id":5421321,"avatar_url":"https://avatars1.githubusercontent.com/u/5421321?v=4","gravatar_id":"","url":"https://api.github.com/users/elwoodxblues","html_url":"https://github.com/elwoodxblues","followers_url":"https://api.github.com/users/elwoodxblues/followers","following_url":"https://api.github.com/users/elwoodxblues/following{/other_user}","gists_url":"https://api.github.com/users/elwoodxblues/gists{/gist_id}","starred_url":"https://api.github.com/users/elwoodxblues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elwoodxblues/subscriptions","organizations_url":"https://api.github.com/users/elwoodxblues/orgs","repos_url":"https://api.github.com/users/elwoodxblues/repos","events_url":"https://api.github.com/users/elwoodxblues/events{/privacy}","received_events_url":"https://api.github.com/users/elwoodxblues/received_events","type":"User","site_admin":false},"body":"In my opinion, this is part of validation that should be handled by a form.","created_at":"2018-02-26T15:07:44Z","updated_at":"2018-02-26T15:15:45Z","html_url":"https://github.com/mirumee/saleor/pull/1780#discussion_r170621254","pull_request_url":"https://api.github.com/repos/mirumee/saleor/pulls/1780","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/comments/170621254"},"html":{"href":"https://github.com/mirumee/saleor/pull/1780#discussion_r170621254"},"pull_request":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/1780"}}},"pull_request":{"url":"https://api.github.com/repos/mirumee/saleor/pulls/1780","id":168859391,"html_url":"https://github.com/mirumee/saleor/pull/1780","diff_url":"https://github.com/mirumee/saleor/pull/1780.diff","patch_url":"https://github.com/mirumee/saleor/pull/1780.patch","issue_url":"https://api.github.com/repos/mirumee/saleor/issues/1780","number":1780,"state":"open","locked":false,"title":"Static page creation from dashboard","user":{"login":"Pacu2","id":21290461,"avatar_url":"https://avatars3.githubusercontent.com/u/21290461?v=4","gravatar_id":"","url":"https://api.github.com/users/Pacu2","html_url":"https://github.com/Pacu2","followers_url":"https://api.github.com/users/Pacu2/followers","following_url":"https://api.github.com/users/Pacu2/following{/other_user}","gists_url":"https://api.github.com/users/Pacu2/gists{/gist_id}","starred_url":"https://api.github.com/users/Pacu2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pacu2/subscriptions","organizations_url":"https://api.github.com/users/Pacu2/orgs","repos_url":"https://api.github.com/users/Pacu2/repos","events_url":"https://api.github.com/users/Pacu2/events{/privacy}","received_events_url":"https://api.github.com/users/Pacu2/received_events","type":"User","site_admin":false},"body":"close #1778 \r\n\r\n### TODO:\r\n- [ ] Tests\r\n- [x] Include public pages in sitemap\r\n- [ ] Implement AceWidget for Dashboard Page view\r\n- [x] Static Page middleware\r\n- [ ] Dashboard permissions and tests for them\r\n- [ ] Models and migrations\r\n\r\n### Pull Request Checklist\r\n\r\n(Please keep this section. It will make maintainer's life easier.)\r\n\r\n1. [ ] Privileged views and APIs are guarded by proper permission checks.\r\n1. [ ] All visible strings are translated with proper context.\r\n1. [ ] All data-formatting is locale-aware (dates, numbers, and so on).\r\n1. [ ] Database queries are optimized and the number of queries is constant.\r\n1. [ ] The changes are tested.\r\n1. [ ] The code is documented (docstrings, project documentation).\r\n1. [ ] Python code quality checks pass: `pycodestyle`, `pydocstyle`, `pylint`.\r\n1. [ ] JavaScript code quality checks pass: `eslint`.\r\n","created_at":"2018-02-13T14:31:33Z","updated_at":"2018-02-26T15:15:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bac02c4b0b7b7a6866ae2b93edfd188a3f997cf6","assignee":{"login":"akjanik","id":8645948,"avatar_url":"https://avatars1.githubusercontent.com/u/8645948?v=4","gravatar_id":"","url":"https://api.github.com/users/akjanik","html_url":"https://github.com/akjanik","followers_url":"https://api.github.com/users/akjanik/followers","following_url":"https://api.github.com/users/akjanik/following{/other_user}","gists_url":"https://api.github.com/users/akjanik/gists{/gist_id}","starred_url":"https://api.github.com/users/akjanik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akjanik/subscriptions","organizations_url":"https://api.github.com/users/akjanik/orgs","repos_url":"https://api.github.com/users/akjanik/repos","events_url":"https://api.github.com/users/akjanik/events{/privacy}","received_events_url":"https://api.github.com/users/akjanik/received_events","type":"User","site_admin":false},"assignees":[{"login":"akjanik","id":8645948,"avatar_url":"https://avatars1.githubusercontent.com/u/8645948?v=4","gravatar_id":"","url":"https://api.github.com/users/akjanik","html_url":"https://github.com/akjanik","followers_url":"https://api.github.com/users/akjanik/followers","following_url":"https://api.github.com/users/akjanik/following{/other_user}","gists_url":"https://api.github.com/users/akjanik/gists{/gist_id}","starred_url":"https://api.github.com/users/akjanik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akjanik/subscriptions","organizations_url":"https://api.github.com/users/akjanik/orgs","repos_url":"https://api.github.com/users/akjanik/repos","events_url":"https://api.github.com/users/akjanik/events{/privacy}","received_events_url":"https://api.github.com/users/akjanik/received_events","type":"User","site_admin":false},{"login":"Pacu2","id":21290461,"avatar_url":"https://avatars3.githubusercontent.com/u/21290461?v=4","gravatar_id":"","url":"https://api.github.com/users/Pacu2","html_url":"https://github.com/Pacu2","followers_url":"https://api.github.com/users/Pacu2/followers","following_url":"https://api.github.com/users/Pacu2/following{/other_user}","gists_url":"https://api.github.com/users/Pacu2/gists{/gist_id}","starred_url":"https://api.github.com/users/Pacu2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pacu2/subscriptions","organizations_url":"https://api.github.com/users/Pacu2/orgs","repos_url":"https://api.github.com/users/Pacu2/repos","events_url":"https://api.github.com/users/Pacu2/events{/privacy}","received_events_url":"https://api.github.com/users/Pacu2/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":85254421,"url":"https://api.github.com/repos/mirumee/saleor/labels/in%20progress","name":"in progress","color":"2980B9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mirumee/saleor/pulls/1780/commits","review_comments_url":"https://api.github.com/repos/mirumee/saleor/pulls/1780/comments","review_comment_url":"https://api.github.com/repos/mirumee/saleor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mirumee/saleor/issues/1780/comments","statuses_url":"https://api.github.com/repos/mirumee/saleor/statuses/c82d6eee0268806e7437ce574a35de644b99b77d","head":{"label":"mirumee:feature/static-page-from-dashboard","ref":"feature/static-page-from-dashboard","sha":"c82d6eee0268806e7437ce574a35de644b99b77d","user":{"login":"mirumee","id":170574,"avatar_url":"https://avatars3.githubusercontent.com/u/170574?v=4","gravatar_id":"","url":"https://api.github.com/users/mirumee","html_url":"https://github.com/mirumee","followers_url":"https://api.github.com/users/mirumee/followers","following_url":"https://api.github.com/users/mirumee/following{/other_user}","gists_url":"https://api.github.com/users/mirumee/gists{/gist_id}","starred_url":"https://api.github.com/users/mirumee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirumee/subscriptions","organizations_url":"https://api.github.com/users/mirumee/orgs","repos_url":"https://api.github.com/users/mirumee/repos","events_url":"https://api.github.com/users/mirumee/events{/privacy}","received_events_url":"https://api.github.com/users/mirumee/received_events","type":"Organization","site_admin":false},"repo":{"id":8162715,"name":"saleor","full_name":"mirumee/saleor","owner":{"login":"mirumee","id":170574,"avatar_url":"https://avatars3.githubusercontent.com/u/170574?v=4","gravatar_id":"","url":"https://api.github.com/users/mirumee","html_url":"https://github.com/mirumee","followers_url":"https://api.github.com/users/mirumee/followers","following_url":"https://api.github.com/users/mirumee/following{/other_user}","gists_url":"https://api.github.com/users/mirumee/gists{/gist_id}","starred_url":"https://api.github.com/users/mirumee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirumee/subscriptions","organizations_url":"https://api.github.com/users/mirumee/orgs","repos_url":"https://api.github.com/users/mirumee/repos","events_url":"https://api.github.com/users/mirumee/events{/privacy}","received_events_url":"https://api.github.com/users/mirumee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mirumee/saleor","description":"An e-commerce storefront for Python and Django","fork":false,"url":"https://api.github.com/repos/mirumee/saleor","forks_url":"https://api.github.com/repos/mirumee/saleor/forks","keys_url":"https://api.github.com/repos/mirumee/saleor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mirumee/saleor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mirumee/saleor/teams","hooks_url":"https://api.github.com/repos/mirumee/saleor/hooks","issue_events_url":"https://api.github.com/repos/mirumee/saleor/issues/events{/number}","events_url":"https://api.github.com/repos/mirumee/saleor/events","assignees_url":"https://api.github.com/repos/mirumee/saleor/assignees{/user}","branches_url":"https://api.github.com/repos/mirumee/saleor/branches{/branch}","tags_url":"https://api.github.com/repos/mirumee/saleor/tags","blobs_url":"https://api.github.com/repos/mirumee/saleor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mirumee/saleor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mirumee/saleor/git/refs{/sha}","trees_url":"https://api.github.com/repos/mirumee/saleor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mirumee/saleor/statuses/{sha}","languages_url":"https://api.github.com/repos/mirumee/saleor/languages","stargazers_url":"https://api.github.com/repos/mirumee/saleor/stargazers","contributors_url":"https://api.github.com/repos/mirumee/saleor/contributors","subscribers_url":"https://api.github.com/repos/mirumee/saleor/subscribers","subscription_url":"https://api.github.com/repos/mirumee/saleor/subscription","commits_url":"https://api.github.com/repos/mirumee/saleor/commits{/sha}","git_commits_url":"https://api.github.com/repos/mirumee/saleor/git/commits{/sha}","comments_url":"https://api.github.com/repos/mirumee/saleor/comments{/number}","issue_comment_url":"https://api.github.com/repos/mirumee/saleor/issues/comments{/number}","contents_url":"https://api.github.com/repos/mirumee/saleor/contents/{+path}","compare_url":"https://api.github.com/repos/mirumee/saleor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mirumee/saleor/merges","archive_url":"https://api.github.com/repos/mirumee/saleor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mirumee/saleor/downloads","issues_url":"https://api.github.com/repos/mirumee/saleor/issues{/number}","pulls_url":"https://api.github.com/repos/mirumee/saleor/pulls{/number}","milestones_url":"https://api.github.com/repos/mirumee/saleor/milestones{/number}","notifications_url":"https://api.github.com/repos/mirumee/saleor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mirumee/saleor/labels{/name}","releases_url":"https://api.github.com/repos/mirumee/saleor/releases{/id}","deployments_url":"https://api.github.com/repos/mirumee/saleor/deployments","created_at":"2013-02-12T16:46:39Z","updated_at":"2018-02-26T12:59:35Z","pushed_at":"2018-02-26T15:14:18Z","git_url":"git://github.com/mirumee/saleor.git","ssh_url":"git@github.com:mirumee/saleor.git","clone_url":"https://github.com/mirumee/saleor.git","svn_url":"https://github.com/mirumee/saleor","homepage":"http://getsaleor.com","size":37150,"stargazers_count":1630,"watchers_count":1630,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":798,"mirror_url":null,"archived":false,"open_issues_count":166,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":798,"open_issues":166,"watchers":1630,"default_branch":"master"}},"base":{"label":"mirumee:master","ref":"master","sha":"f5d0fa7235cb435b16822ee8f148a837aed8dd37","user":{"login":"mirumee","id":170574,"avatar_url":"https://avatars3.githubusercontent.com/u/170574?v=4","gravatar_id":"","url":"https://api.github.com/users/mirumee","html_url":"https://github.com/mirumee","followers_url":"https://api.github.com/users/mirumee/followers","following_url":"https://api.github.com/users/mirumee/following{/other_user}","gists_url":"https://api.github.com/users/mirumee/gists{/gist_id}","starred_url":"https://api.github.com/users/mirumee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirumee/subscriptions","organizations_url":"https://api.github.com/users/mirumee/orgs","repos_url":"https://api.github.com/users/mirumee/repos","events_url":"https://api.github.com/users/mirumee/events{/privacy}","received_events_url":"https://api.github.com/users/mirumee/received_events","type":"Organization","site_admin":false},"repo":{"id":8162715,"name":"saleor","full_name":"mirumee/saleor","owner":{"login":"mirumee","id":170574,"avatar_url":"https://avatars3.githubusercontent.com/u/170574?v=4","gravatar_id":"","url":"https://api.github.com/users/mirumee","html_url":"https://github.com/mirumee","followers_url":"https://api.github.com/users/mirumee/followers","following_url":"https://api.github.com/users/mirumee/following{/other_user}","gists_url":"https://api.github.com/users/mirumee/gists{/gist_id}","starred_url":"https://api.github.com/users/mirumee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirumee/subscriptions","organizations_url":"https://api.github.com/users/mirumee/orgs","repos_url":"https://api.github.com/users/mirumee/repos","events_url":"https://api.github.com/users/mirumee/events{/privacy}","received_events_url":"https://api.github.com/users/mirumee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mirumee/saleor","description":"An e-commerce storefront for Python and Django","fork":false,"url":"https://api.github.com/repos/mirumee/saleor","forks_url":"https://api.github.com/repos/mirumee/saleor/forks","keys_url":"https://api.github.com/repos/mirumee/saleor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mirumee/saleor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mirumee/saleor/teams","hooks_url":"https://api.github.com/repos/mirumee/saleor/hooks","issue_events_url":"https://api.github.com/repos/mirumee/saleor/issues/events{/number}","events_url":"https://api.github.com/repos/mirumee/saleor/events","assignees_url":"https://api.github.com/repos/mirumee/saleor/assignees{/user}","branches_url":"https://api.github.com/repos/mirumee/saleor/branches{/branch}","tags_url":"https://api.github.com/repos/mirumee/saleor/tags","blobs_url":"https://api.github.com/repos/mirumee/saleor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mirumee/saleor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mirumee/saleor/git/refs{/sha}","trees_url":"https://api.github.com/repos/mirumee/saleor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mirumee/saleor/statuses/{sha}","languages_url":"https://api.github.com/repos/mirumee/saleor/languages","stargazers_url":"https://api.github.com/repos/mirumee/saleor/stargazers","contributors_url":"https://api.github.com/repos/mirumee/saleor/contributors","subscribers_url":"https://api.github.com/repos/mirumee/saleor/subscribers","subscription_url":"https://api.github.com/repos/mirumee/saleor/subscription","commits_url":"https://api.github.com/repos/mirumee/saleor/commits{/sha}","git_commits_url":"https://api.github.com/repos/mirumee/saleor/git/commits{/sha}","comments_url":"https://api.github.com/repos/mirumee/saleor/comments{/number}","issue_comment_url":"https://api.github.com/repos/mirumee/saleor/issues/comments{/number}","contents_url":"https://api.github.com/repos/mirumee/saleor/contents/{+path}","compare_url":"https://api.github.com/repos/mirumee/saleor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mirumee/saleor/merges","archive_url":"https://api.github.com/repos/mirumee/saleor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mirumee/saleor/downloads","issues_url":"https://api.github.com/repos/mirumee/saleor/issues{/number}","pulls_url":"https://api.github.com/repos/mirumee/saleor/pulls{/number}","milestones_url":"https://api.github.com/repos/mirumee/saleor/milestones{/number}","notifications_url":"https://api.github.com/repos/mirumee/saleor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mirumee/saleor/labels{/name}","releases_url":"https://api.github.com/repos/mirumee/saleor/releases{/id}","deployments_url":"https://api.github.com/repos/mirumee/saleor/deployments","created_at":"2013-02-12T16:46:39Z","updated_at":"2018-02-26T12:59:35Z","pushed_at":"2018-02-26T15:14:18Z","git_url":"git://github.com/mirumee/saleor.git","ssh_url":"git@github.com:mirumee/saleor.git","clone_url":"https://github.com/mirumee/saleor.git","svn_url":"https://github.com/mirumee/saleor","homepage":"http://getsaleor.com","size":37150,"stargazers_count":1630,"watchers_count":1630,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":798,"mirror_url":null,"archived":false,"open_issues_count":166,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":798,"open_issues":166,"watchers":1630,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/1780"},"html":{"href":"https://github.com/mirumee/saleor/pull/1780"},"issue":{"href":"https://api.github.com/repos/mirumee/saleor/issues/1780"},"comments":{"href":"https://api.github.com/repos/mirumee/saleor/issues/1780/comments"},"review_comments":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/1780/comments"},"review_comment":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mirumee/saleor/pulls/1780/commits"},"statuses":{"href":"https://api.github.com/repos/mirumee/saleor/statuses/c82d6eee0268806e7437ce574a35de644b99b77d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"elwoodxblues"}}