{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/32681483","id":32681483,"diff_hunk":"@@ -11,15 +11,90 @@\n \n import mkt\n from lib.utils import static_url\n+from mkt.api.fields import IntegerRangeField\n from mkt.constants.applications import DEVICE_TYPE_LIST\n from mkt.constants.base import LISTED_STATUSES, STATUS_CHOICES, STATUS_NULL\n from mkt.site.models import ManagerBase, ModelBase\n from mkt.site.utils import get_icon_url\n from mkt.tags.models import Tag\n from mkt.translations.fields import save_signal, TranslatedField\n+from mkt.users.models import UserProfile\n from mkt.websites.indexers import WebsiteIndexer\n \n \n+class WebsiteSubmissionManager(ManagerBase):\n+    \"\"\"\n+    Custom manager for the WebsiteSubmission model. By default, exclude all\n+    approved sites from querysets.\n+    \"\"\"\n+    def get_queryset(self):\n+        qs = super(WebsiteSubmissionManager, self).get_queryset()\n+        return qs.filter(approved=False)\n+\n+    def approved(self):\n+        qs = super(WebsiteSubmissionManager, self).get_queryset()\n+        return qs.filter(approved=True)\n+\n+\n+class WebsiteSubmission(ModelBase):\n+    \"\"\"\n+    Model representing a website submission.\n+\n+    When approved, the data from this will be copied to a new instance of the\n+    Website model, and approved=True will be set on the submission instance.\n+    \"\"\"\n+    name = TranslatedField()\n+    keywords = models.ManyToManyField(Tag)\n+    description = TranslatedField()\n+    categories = JSONField(default=None)\n+\n+    date_approved = models.DateTimeField(blank=True)\n+\n+    # `detected_icon` is the URL of the icon we are able to gather from the\n+    # submitted site's metadata. In the reviewer tools, reviewers will be able\n+    # to accept that icon, or upload one of their own.\n+    detected_icon = models.URLField(max_length=255, blank=True)\n+    icon_type = models.CharField(max_length=25, blank=True)\n+    icon_hash = models.CharField(max_length=8, blank=True)\n+\n+    # The `url` field is the URL as entered by the submitter. The\n+    # `canonical_url` field is the URL that the site reports as the canonical\n+    # location for the submitted URL. In the reviewer tools, reviewers will\n+    # have the ability to copy the `canonical_url` value to the `url` field.\n+    url = models.URLField(max_length=255)\n+    canonical_url = models.URLField(max_length=255, blank=True, null=True)\n+\n+    # A 1-5 Likert scale indicating how well the submitter says the website\n+    # works. This is primarily used to make the submitter question the\n+    # relevance of their submission, though submissions should be prevented if\n+    # the user says it works poorly.\n+    works_well = IntegerRangeField(min_value=2, max_value=5)\n+\n+    # Who is submitting the website? Do they want public credit for their\n+    # submission?\n+    submitter = models.ForeignKey(UserProfile,\n+                                  related_name='websites_submitted')\n+    public_credit = models.BooleanField(default=False)","path":"mkt/websites/models.py","position":67,"original_position":67,"commit_id":"74a3354bc5dce7bea18d9fc31a9242e32748093e","original_commit_id":"74a3354bc5dce7bea18d9fc31a9242e32748093e","user":{"login":"mstriemer","id":211578,"avatar_url":"https://avatars.githubusercontent.com/u/211578?v=3","gravatar_id":"","url":"https://api.github.com/users/mstriemer","html_url":"https://github.com/mstriemer","followers_url":"https://api.github.com/users/mstriemer/followers","following_url":"https://api.github.com/users/mstriemer/following{/other_user}","gists_url":"https://api.github.com/users/mstriemer/gists{/gist_id}","starred_url":"https://api.github.com/users/mstriemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstriemer/subscriptions","organizations_url":"https://api.github.com/users/mstriemer/orgs","repos_url":"https://api.github.com/users/mstriemer/repos","events_url":"https://api.github.com/users/mstriemer/events{/privacy}","received_events_url":"https://api.github.com/users/mstriemer/received_events","type":"User","site_admin":false},"body":"I'm not sure how this is supposed to work with the same website being submitted by multiple users. I guess at some point there be a many-to-one from `WebsiteSubmission` to `Website`. Not expecting a change about it and this could be addressed in the PRD but thought I'd mention it.","created_at":"2015-06-17T22:19:29Z","updated_at":"2015-06-17T22:19:29Z","html_url":"https://github.com/mozilla/zamboni/pull/3140#discussion_r32681483","pull_request_url":"https://api.github.com/repos/mozilla/zamboni/pulls/3140","_links":{"self":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/comments/32681483"},"html":{"href":"https://github.com/mozilla/zamboni/pull/3140#discussion_r32681483"},"pull_request":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/3140"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/zamboni/pulls/3140","id":37941686,"html_url":"https://github.com/mozilla/zamboni/pull/3140","diff_url":"https://github.com/mozilla/zamboni/pull/3140.diff","patch_url":"https://github.com/mozilla/zamboni/pull/3140.patch","issue_url":"https://api.github.com/repos/mozilla/zamboni/issues/3140","number":3140,"state":"open","locked":false,"title":"Adds WebsiteSubmission model.","user":{"login":"chuckharmston","id":23885,"avatar_url":"https://avatars.githubusercontent.com/u/23885?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckharmston","html_url":"https://github.com/chuckharmston","followers_url":"https://api.github.com/users/chuckharmston/followers","following_url":"https://api.github.com/users/chuckharmston/following{/other_user}","gists_url":"https://api.github.com/users/chuckharmston/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckharmston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckharmston/subscriptions","organizations_url":"https://api.github.com/users/chuckharmston/orgs","repos_url":"https://api.github.com/users/chuckharmston/repos","events_url":"https://api.github.com/users/chuckharmston/events{/privacy}","received_events_url":"https://api.github.com/users/chuckharmston/received_events","type":"User","site_admin":false},"body":"Creating PR to get Travis on the case, but if you want to r? @ngokevin, I wouldn't be opposed.","created_at":"2015-06-17T20:15:33Z","updated_at":"2015-06-17T22:19:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fef89d2dd7d9619785a1b255ad38c76c502cfca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/zamboni/pulls/3140/commits","review_comments_url":"https://api.github.com/repos/mozilla/zamboni/pulls/3140/comments","review_comment_url":"https://api.github.com/repos/mozilla/zamboni/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/zamboni/issues/3140/comments","statuses_url":"https://api.github.com/repos/mozilla/zamboni/statuses/74a3354bc5dce7bea18d9fc31a9242e32748093e","head":{"label":"chuckharmston:website_submission_model","ref":"website_submission_model","sha":"74a3354bc5dce7bea18d9fc31a9242e32748093e","user":{"login":"chuckharmston","id":23885,"avatar_url":"https://avatars.githubusercontent.com/u/23885?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckharmston","html_url":"https://github.com/chuckharmston","followers_url":"https://api.github.com/users/chuckharmston/followers","following_url":"https://api.github.com/users/chuckharmston/following{/other_user}","gists_url":"https://api.github.com/users/chuckharmston/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckharmston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckharmston/subscriptions","organizations_url":"https://api.github.com/users/chuckharmston/orgs","repos_url":"https://api.github.com/users/chuckharmston/repos","events_url":"https://api.github.com/users/chuckharmston/events{/privacy}","received_events_url":"https://api.github.com/users/chuckharmston/received_events","type":"User","site_admin":false},"repo":{"id":17600281,"name":"zamboni","full_name":"chuckharmston/zamboni","owner":{"login":"chuckharmston","id":23885,"avatar_url":"https://avatars.githubusercontent.com/u/23885?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckharmston","html_url":"https://github.com/chuckharmston","followers_url":"https://api.github.com/users/chuckharmston/followers","following_url":"https://api.github.com/users/chuckharmston/following{/other_user}","gists_url":"https://api.github.com/users/chuckharmston/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckharmston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckharmston/subscriptions","organizations_url":"https://api.github.com/users/chuckharmston/orgs","repos_url":"https://api.github.com/users/chuckharmston/repos","events_url":"https://api.github.com/users/chuckharmston/events{/privacy}","received_events_url":"https://api.github.com/users/chuckharmston/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chuckharmston/zamboni","description":"The Firefox Marketplace and addons.mozilla.org","fork":true,"url":"https://api.github.com/repos/chuckharmston/zamboni","forks_url":"https://api.github.com/repos/chuckharmston/zamboni/forks","keys_url":"https://api.github.com/repos/chuckharmston/zamboni/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chuckharmston/zamboni/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chuckharmston/zamboni/teams","hooks_url":"https://api.github.com/repos/chuckharmston/zamboni/hooks","issue_events_url":"https://api.github.com/repos/chuckharmston/zamboni/issues/events{/number}","events_url":"https://api.github.com/repos/chuckharmston/zamboni/events","assignees_url":"https://api.github.com/repos/chuckharmston/zamboni/assignees{/user}","branches_url":"https://api.github.com/repos/chuckharmston/zamboni/branches{/branch}","tags_url":"https://api.github.com/repos/chuckharmston/zamboni/tags","blobs_url":"https://api.github.com/repos/chuckharmston/zamboni/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chuckharmston/zamboni/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chuckharmston/zamboni/git/refs{/sha}","trees_url":"https://api.github.com/repos/chuckharmston/zamboni/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chuckharmston/zamboni/statuses/{sha}","languages_url":"https://api.github.com/repos/chuckharmston/zamboni/languages","stargazers_url":"https://api.github.com/repos/chuckharmston/zamboni/stargazers","contributors_url":"https://api.github.com/repos/chuckharmston/zamboni/contributors","subscribers_url":"https://api.github.com/repos/chuckharmston/zamboni/subscribers","subscription_url":"https://api.github.com/repos/chuckharmston/zamboni/subscription","commits_url":"https://api.github.com/repos/chuckharmston/zamboni/commits{/sha}","git_commits_url":"https://api.github.com/repos/chuckharmston/zamboni/git/commits{/sha}","comments_url":"https://api.github.com/repos/chuckharmston/zamboni/comments{/number}","issue_comment_url":"https://api.github.com/repos/chuckharmston/zamboni/issues/comments{/number}","contents_url":"https://api.github.com/repos/chuckharmston/zamboni/contents/{+path}","compare_url":"https://api.github.com/repos/chuckharmston/zamboni/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chuckharmston/zamboni/merges","archive_url":"https://api.github.com/repos/chuckharmston/zamboni/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chuckharmston/zamboni/downloads","issues_url":"https://api.github.com/repos/chuckharmston/zamboni/issues{/number}","pulls_url":"https://api.github.com/repos/chuckharmston/zamboni/pulls{/number}","milestones_url":"https://api.github.com/repos/chuckharmston/zamboni/milestones{/number}","notifications_url":"https://api.github.com/repos/chuckharmston/zamboni/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chuckharmston/zamboni/labels{/name}","releases_url":"https://api.github.com/repos/chuckharmston/zamboni/releases{/id}","created_at":"2014-03-10T16:49:52Z","updated_at":"2015-03-21T19:46:50Z","pushed_at":"2015-06-17T22:16:09Z","git_url":"git://github.com/chuckharmston/zamboni.git","ssh_url":"git@github.com:chuckharmston/zamboni.git","clone_url":"https://github.com/chuckharmston/zamboni.git","svn_url":"https://github.com/chuckharmston/zamboni","homepage":"http://zamboni.readthedocs.org","size":362068,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"da225cced3b46127a34d8715f1d3710e808dc94b","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":347655,"name":"zamboni","full_name":"mozilla/zamboni","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/zamboni","description":"Backend for the Firefox Marketplace","fork":false,"url":"https://api.github.com/repos/mozilla/zamboni","forks_url":"https://api.github.com/repos/mozilla/zamboni/forks","keys_url":"https://api.github.com/repos/mozilla/zamboni/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/zamboni/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/zamboni/teams","hooks_url":"https://api.github.com/repos/mozilla/zamboni/hooks","issue_events_url":"https://api.github.com/repos/mozilla/zamboni/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/zamboni/events","assignees_url":"https://api.github.com/repos/mozilla/zamboni/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/zamboni/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/zamboni/tags","blobs_url":"https://api.github.com/repos/mozilla/zamboni/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/zamboni/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/zamboni/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/zamboni/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/zamboni/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/zamboni/languages","stargazers_url":"https://api.github.com/repos/mozilla/zamboni/stargazers","contributors_url":"https://api.github.com/repos/mozilla/zamboni/contributors","subscribers_url":"https://api.github.com/repos/mozilla/zamboni/subscribers","subscription_url":"https://api.github.com/repos/mozilla/zamboni/subscription","commits_url":"https://api.github.com/repos/mozilla/zamboni/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/zamboni/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/zamboni/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/zamboni/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/zamboni/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/zamboni/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/zamboni/merges","archive_url":"https://api.github.com/repos/mozilla/zamboni/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/zamboni/downloads","issues_url":"https://api.github.com/repos/mozilla/zamboni/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/zamboni/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/zamboni/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/zamboni/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/zamboni/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/zamboni/releases{/id}","created_at":"2009-10-23T19:35:34Z","updated_at":"2015-06-05T18:54:34Z","pushed_at":"2015-06-17T22:16:10Z","git_url":"git://github.com/mozilla/zamboni.git","ssh_url":"git@github.com:mozilla/zamboni.git","clone_url":"https://github.com/mozilla/zamboni.git","svn_url":"https://github.com/mozilla/zamboni","homepage":"http://marketplace.readthedocs.org/en/latest/topics/backend.html","size":432827,"stargazers_count":464,"watchers_count":464,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":243,"mirror_url":null,"open_issues_count":16,"forks":243,"open_issues":16,"watchers":464,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/3140"},"html":{"href":"https://github.com/mozilla/zamboni/pull/3140"},"issue":{"href":"https://api.github.com/repos/mozilla/zamboni/issues/3140"},"comments":{"href":"https://api.github.com/repos/mozilla/zamboni/issues/3140/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/3140/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/zamboni/pulls/3140/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/zamboni/statuses/74a3354bc5dce7bea18d9fc31a9242e32748093e"}}}}