{"action":"created","comment":{"url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/comments/206599041","pull_request_review_id":142042031,"id":206599041,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjU5OTA0MQ==","diff_hunk":"@@ -0,0 +1,42 @@\n+from functools import partial\n+import uuid\n+\n+from django.db import models\n+from django.contrib.auth.hashers import check_password, make_password\n+from django.utils.crypto import get_random_string\n+\n+from core import helpers\n+\n+\n+class Client(helpers.TimeStampedModel):\n+    client_id = models.UUIDField(\n+        max_length=150,\n+        unique=True,\n+        default=uuid.uuid4,\n+        primary_key=True,\n+    )\n+    access_key = models.CharField(\n+        help_text='Value is plain text during create. Hashed on edit.',\n+        max_length=128,\n+        default=partial(get_random_string, length=64),\n+    )\n+    client_name = models.CharField(\n+        help_text='Human friendly name to help identify the record.',\n+        max_length=150,\n+        unique=True,\n+    )\n+    is_active = models.BooleanField(default=True)\n+\n+    def check_access_key(self, raw_access_key):\n+        return check_password(raw_access_key, self.access_key)\n+\n+    def set_access_key(self, access_key):\n+        self.access_key = make_password(access_key)\n+\n+    def save(self, *args, **kwargs):\n+        # `_state` is not \"private\", in the same way \"_meta\" is not, they\n+        # are just prefixed to avoid conflicting with field names. _state is\n+        # an instance of `ModelState.\n+        if self._state.adding is True:","path":"client/models.py","position":40,"original_position":40,"commit_id":"835fde8cf92a839a6cb07a89bb4985c73a198ae7","original_commit_id":"835fde8cf92a839a6cb07a89bb4985c73a198ae7","user":{"login":"konradko","id":2781766,"node_id":"MDQ6VXNlcjI3ODE3NjY=","avatar_url":"https://avatars2.githubusercontent.com/u/2781766?v=4","gravatar_id":"","url":"https://api.github.com/users/konradko","html_url":"https://github.com/konradko","followers_url":"https://api.github.com/users/konradko/followers","following_url":"https://api.github.com/users/konradko/following{/other_user}","gists_url":"https://api.github.com/users/konradko/gists{/gist_id}","starred_url":"https://api.github.com/users/konradko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/konradko/subscriptions","organizations_url":"https://api.github.com/users/konradko/orgs","repos_url":"https://api.github.com/users/konradko/repos","events_url":"https://api.github.com/users/konradko/events{/privacy}","received_events_url":"https://api.github.com/users/konradko/received_events","type":"User","site_admin":false},"body":"ah nice","created_at":"2018-07-31T16:36:27Z","updated_at":"2018-07-31T16:36:28Z","html_url":"https://github.com/uktrade/directory-forms-api/pull/1#discussion_r206599041","pull_request_url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/comments/206599041"},"html":{"href":"https://github.com/uktrade/directory-forms-api/pull/1#discussion_r206599041"},"pull_request":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1"}},"in_reply_to_id":206595030},"pull_request":{"url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1","id":204762228,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NzYyMjI4","html_url":"https://github.com/uktrade/directory-forms-api/pull/1","diff_url":"https://github.com/uktrade/directory-forms-api/pull/1.diff","patch_url":"https://github.com/uktrade/directory-forms-api/pull/1.patch","issue_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues/1","number":1,"state":"open","locked":false,"title":"Form submission","user":{"login":"richtier","id":5485798,"node_id":"MDQ6VXNlcjU0ODU3OTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5485798?v=4","gravatar_id":"","url":"https://api.github.com/users/richtier","html_url":"https://github.com/richtier","followers_url":"https://api.github.com/users/richtier/followers","following_url":"https://api.github.com/users/richtier/following{/other_user}","gists_url":"https://api.github.com/users/richtier/gists{/gist_id}","starred_url":"https://api.github.com/users/richtier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richtier/subscriptions","organizations_url":"https://api.github.com/users/richtier/orgs","repos_url":"https://api.github.com/users/richtier/repos","events_url":"https://api.github.com/users/richtier/events{/privacy}","received_events_url":"https://api.github.com/users/richtier/received_events","type":"User","site_admin":false},"body":"[this task](https://uktrade.atlassian.net/browse/TT-242)\r\n\r\n# FormSubmission\r\n## Create\r\n\r\n![image](https://user-images.githubusercontent.com/5485798/43392800-ada5d3fa-93ec-11e8-8508-2b6dd29b8e23.png)\r\n\r\n## List (including filtering by backend)\r\n\r\n![image](https://user-images.githubusercontent.com/5485798/43392811-b37cc1e4-93ec-11e8-8457-6f88998519c7.png)\r\n\r\n## Detail\r\n\r\n![image](https://user-images.githubusercontent.com/5485798/43392823-bbb6384a-93ec-11e8-9fcd-803f2d67e780.png)\r\n\r\n# API client\r\n\r\n## Create\r\n![image](https://user-images.githubusercontent.com/5485798/43411583-76eca8f8-9422-11e8-9eac-2b35a30b2fa8.png)\r\n\r\n\r\n## List\r\n![image](https://user-images.githubusercontent.com/5485798/43411574-6f277314-9422-11e8-80cf-62f904376070.png)\r\n\r\n## Detail\r\n\r\n![image](https://user-images.githubusercontent.com/5485798/43411565-68f2860a-9422-11e8-8685-bb4c14d79905.png)\r\n","created_at":"2018-07-30T10:36:56Z","updated_at":"2018-07-31T16:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1d16765ee336a37c8fb2deca8e84771a6cfd7ae","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1/commits","review_comments_url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1/comments","review_comment_url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues/1/comments","statuses_url":"https://api.github.com/repos/uktrade/directory-forms-api/statuses/835fde8cf92a839a6cb07a89bb4985c73a198ae7","head":{"label":"uktrade:TT-241-form-submission","ref":"TT-241-form-submission","sha":"835fde8cf92a839a6cb07a89bb4985c73a198ae7","user":{"login":"uktrade","id":15107524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTA3NTI0","avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"repo":{"id":142036240,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIwMzYyNDA=","name":"directory-forms-api","full_name":"uktrade/directory-forms-api","owner":{"login":"uktrade","id":15107524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTA3NTI0","avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uktrade/directory-forms-api","description":null,"fork":false,"url":"https://api.github.com/repos/uktrade/directory-forms-api","forks_url":"https://api.github.com/repos/uktrade/directory-forms-api/forks","keys_url":"https://api.github.com/repos/uktrade/directory-forms-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uktrade/directory-forms-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uktrade/directory-forms-api/teams","hooks_url":"https://api.github.com/repos/uktrade/directory-forms-api/hooks","issue_events_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues/events{/number}","events_url":"https://api.github.com/repos/uktrade/directory-forms-api/events","assignees_url":"https://api.github.com/repos/uktrade/directory-forms-api/assignees{/user}","branches_url":"https://api.github.com/repos/uktrade/directory-forms-api/branches{/branch}","tags_url":"https://api.github.com/repos/uktrade/directory-forms-api/tags","blobs_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uktrade/directory-forms-api/statuses/{sha}","languages_url":"https://api.github.com/repos/uktrade/directory-forms-api/languages","stargazers_url":"https://api.github.com/repos/uktrade/directory-forms-api/stargazers","contributors_url":"https://api.github.com/repos/uktrade/directory-forms-api/contributors","subscribers_url":"https://api.github.com/repos/uktrade/directory-forms-api/subscribers","subscription_url":"https://api.github.com/repos/uktrade/directory-forms-api/subscription","commits_url":"https://api.github.com/repos/uktrade/directory-forms-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/uktrade/directory-forms-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/uktrade/directory-forms-api/contents/{+path}","compare_url":"https://api.github.com/repos/uktrade/directory-forms-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uktrade/directory-forms-api/merges","archive_url":"https://api.github.com/repos/uktrade/directory-forms-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uktrade/directory-forms-api/downloads","issues_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues{/number}","pulls_url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls{/number}","milestones_url":"https://api.github.com/repos/uktrade/directory-forms-api/milestones{/number}","notifications_url":"https://api.github.com/repos/uktrade/directory-forms-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uktrade/directory-forms-api/labels{/name}","releases_url":"https://api.github.com/repos/uktrade/directory-forms-api/releases{/id}","deployments_url":"https://api.github.com/repos/uktrade/directory-forms-api/deployments","created_at":"2018-07-23T15:50:25Z","updated_at":"2018-07-24T16:28:18Z","pushed_at":"2018-07-31T16:12:43Z","git_url":"git://github.com/uktrade/directory-forms-api.git","ssh_url":"git@github.com:uktrade/directory-forms-api.git","clone_url":"https://github.com/uktrade/directory-forms-api.git","svn_url":"https://github.com/uktrade/directory-forms-api","homepage":null,"size":34,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"uktrade:master","ref":"master","sha":"81fd9ac1670f12df29bca8b18ff424f4c611d0ca","user":{"login":"uktrade","id":15107524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTA3NTI0","avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"repo":{"id":142036240,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIwMzYyNDA=","name":"directory-forms-api","full_name":"uktrade/directory-forms-api","owner":{"login":"uktrade","id":15107524,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MTA3NTI0","avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uktrade/directory-forms-api","description":null,"fork":false,"url":"https://api.github.com/repos/uktrade/directory-forms-api","forks_url":"https://api.github.com/repos/uktrade/directory-forms-api/forks","keys_url":"https://api.github.com/repos/uktrade/directory-forms-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uktrade/directory-forms-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uktrade/directory-forms-api/teams","hooks_url":"https://api.github.com/repos/uktrade/directory-forms-api/hooks","issue_events_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues/events{/number}","events_url":"https://api.github.com/repos/uktrade/directory-forms-api/events","assignees_url":"https://api.github.com/repos/uktrade/directory-forms-api/assignees{/user}","branches_url":"https://api.github.com/repos/uktrade/directory-forms-api/branches{/branch}","tags_url":"https://api.github.com/repos/uktrade/directory-forms-api/tags","blobs_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uktrade/directory-forms-api/statuses/{sha}","languages_url":"https://api.github.com/repos/uktrade/directory-forms-api/languages","stargazers_url":"https://api.github.com/repos/uktrade/directory-forms-api/stargazers","contributors_url":"https://api.github.com/repos/uktrade/directory-forms-api/contributors","subscribers_url":"https://api.github.com/repos/uktrade/directory-forms-api/subscribers","subscription_url":"https://api.github.com/repos/uktrade/directory-forms-api/subscription","commits_url":"https://api.github.com/repos/uktrade/directory-forms-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/uktrade/directory-forms-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/uktrade/directory-forms-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/uktrade/directory-forms-api/contents/{+path}","compare_url":"https://api.github.com/repos/uktrade/directory-forms-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uktrade/directory-forms-api/merges","archive_url":"https://api.github.com/repos/uktrade/directory-forms-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uktrade/directory-forms-api/downloads","issues_url":"https://api.github.com/repos/uktrade/directory-forms-api/issues{/number}","pulls_url":"https://api.github.com/repos/uktrade/directory-forms-api/pulls{/number}","milestones_url":"https://api.github.com/repos/uktrade/directory-forms-api/milestones{/number}","notifications_url":"https://api.github.com/repos/uktrade/directory-forms-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uktrade/directory-forms-api/labels{/name}","releases_url":"https://api.github.com/repos/uktrade/directory-forms-api/releases{/id}","deployments_url":"https://api.github.com/repos/uktrade/directory-forms-api/deployments","created_at":"2018-07-23T15:50:25Z","updated_at":"2018-07-24T16:28:18Z","pushed_at":"2018-07-31T16:12:43Z","git_url":"git://github.com/uktrade/directory-forms-api.git","ssh_url":"git@github.com:uktrade/directory-forms-api.git","clone_url":"https://github.com/uktrade/directory-forms-api.git","svn_url":"https://github.com/uktrade/directory-forms-api","homepage":null,"size":34,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1"},"html":{"href":"https://github.com/uktrade/directory-forms-api/pull/1"},"issue":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/issues/1"},"comments":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/uktrade/directory-forms-api/statuses/835fde8cf92a839a6cb07a89bb4985c73a198ae7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"konradko"}}