{"action":"created","comment":{"url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/comments/277159085","pull_request_review_id":228903805,"id":277159085,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3NzE1OTA4NQ==","diff_hunk":"@@ -0,0 +1,21 @@\n+from rest_framework import serializers\n+from main.models import RunningSession\n+\n+class RunningSessionSerializer(serializers.ModelSerializer):\n+\n+    class Meta:\n+        model = RunningSession\n+        fields = ('distance', 'time',)\n+\n+\n+    def validate(self, data):\n+        \"\"\"\n+        Check that the time and distance  greater than 0.\n+        \"\"\"\n+        if data['time'] < 1:","path":"main/serializers.py","position":15,"original_position":15,"commit_id":"c59b80b927a32cb2eacbc57845d7327e96ef52f8","original_commit_id":"c59b80b927a32cb2eacbc57845d7327e96ef52f8","user":{"login":"waseem-omar","id":8616348,"node_id":"MDQ6VXNlcjg2MTYzNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/8616348?v=4","gravatar_id":"","url":"https://api.github.com/users/waseem-omar","html_url":"https://github.com/waseem-omar","followers_url":"https://api.github.com/users/waseem-omar/followers","following_url":"https://api.github.com/users/waseem-omar/following{/other_user}","gists_url":"https://api.github.com/users/waseem-omar/gists{/gist_id}","starred_url":"https://api.github.com/users/waseem-omar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waseem-omar/subscriptions","organizations_url":"https://api.github.com/users/waseem-omar/orgs","repos_url":"https://api.github.com/users/waseem-omar/repos","events_url":"https://api.github.com/users/waseem-omar/events{/privacy}","received_events_url":"https://api.github.com/users/waseem-omar/received_events","type":"User","site_admin":false},"body":"@suhaibbaba In DRF there are better ways to do the validation you are trying to do here:\r\n\r\n1. You can do field-level validation.\r\n2. Even better, you can set `validators` parameter in the model field itself, which will do the validation on query level, and DRf will do validation based on the model field validator.","created_at":"2019-04-21T08:36:23Z","updated_at":"2019-04-21T08:36:23Z","html_url":"https://github.com/foundertherapy/engineering-task/pull/1#discussion_r277159085","pull_request_url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/comments/277159085"},"html":{"href":"https://github.com/foundertherapy/engineering-task/pull/1#discussion_r277159085"},"pull_request":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1","id":272156387,"node_id":"MDExOlB1bGxSZXF1ZXN0MjcyMTU2Mzg3","html_url":"https://github.com/foundertherapy/engineering-task/pull/1","diff_url":"https://github.com/foundertherapy/engineering-task/pull/1.diff","patch_url":"https://github.com/foundertherapy/engineering-task/pull/1.patch","issue_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues/1","number":1,"state":"open","locked":false,"title":"Suhaib","user":{"login":"awartani","id":493669,"node_id":"MDQ6VXNlcjQ5MzY2OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/493669?v=4","gravatar_id":"","url":"https://api.github.com/users/awartani","html_url":"https://github.com/awartani","followers_url":"https://api.github.com/users/awartani/followers","following_url":"https://api.github.com/users/awartani/following{/other_user}","gists_url":"https://api.github.com/users/awartani/gists{/gist_id}","starred_url":"https://api.github.com/users/awartani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awartani/subscriptions","organizations_url":"https://api.github.com/users/awartani/orgs","repos_url":"https://api.github.com/users/awartani/repos","events_url":"https://api.github.com/users/awartani/events{/privacy}","received_events_url":"https://api.github.com/users/awartani/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-04-20T14:32:29Z","updated_at":"2019-04-21T08:36:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ab532e5bcb6a2c97cdcc37e2fe24c502911bfc1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1/commits","review_comments_url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1/comments","review_comment_url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/comments{/number}","comments_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues/1/comments","statuses_url":"https://api.github.com/repos/foundertherapy/engineering-task/statuses/c59b80b927a32cb2eacbc57845d7327e96ef52f8","head":{"label":"foundertherapy:suhaib","ref":"suhaib","sha":"c59b80b927a32cb2eacbc57845d7327e96ef52f8","user":{"login":"foundertherapy","id":8397367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgzOTczNjc=","avatar_url":"https://avatars3.githubusercontent.com/u/8397367?v=4","gravatar_id":"","url":"https://api.github.com/users/foundertherapy","html_url":"https://github.com/foundertherapy","followers_url":"https://api.github.com/users/foundertherapy/followers","following_url":"https://api.github.com/users/foundertherapy/following{/other_user}","gists_url":"https://api.github.com/users/foundertherapy/gists{/gist_id}","starred_url":"https://api.github.com/users/foundertherapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foundertherapy/subscriptions","organizations_url":"https://api.github.com/users/foundertherapy/orgs","repos_url":"https://api.github.com/users/foundertherapy/repos","events_url":"https://api.github.com/users/foundertherapy/events{/privacy}","received_events_url":"https://api.github.com/users/foundertherapy/received_events","type":"Organization","site_admin":false},"repo":{"id":182408737,"node_id":"MDEwOlJlcG9zaXRvcnkxODI0MDg3Mzc=","name":"engineering-task","full_name":"foundertherapy/engineering-task","private":false,"owner":{"login":"foundertherapy","id":8397367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgzOTczNjc=","avatar_url":"https://avatars3.githubusercontent.com/u/8397367?v=4","gravatar_id":"","url":"https://api.github.com/users/foundertherapy","html_url":"https://github.com/foundertherapy","followers_url":"https://api.github.com/users/foundertherapy/followers","following_url":"https://api.github.com/users/foundertherapy/following{/other_user}","gists_url":"https://api.github.com/users/foundertherapy/gists{/gist_id}","starred_url":"https://api.github.com/users/foundertherapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foundertherapy/subscriptions","organizations_url":"https://api.github.com/users/foundertherapy/orgs","repos_url":"https://api.github.com/users/foundertherapy/repos","events_url":"https://api.github.com/users/foundertherapy/events{/privacy}","received_events_url":"https://api.github.com/users/foundertherapy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/foundertherapy/engineering-task","description":null,"fork":false,"url":"https://api.github.com/repos/foundertherapy/engineering-task","forks_url":"https://api.github.com/repos/foundertherapy/engineering-task/forks","keys_url":"https://api.github.com/repos/foundertherapy/engineering-task/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foundertherapy/engineering-task/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foundertherapy/engineering-task/teams","hooks_url":"https://api.github.com/repos/foundertherapy/engineering-task/hooks","issue_events_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues/events{/number}","events_url":"https://api.github.com/repos/foundertherapy/engineering-task/events","assignees_url":"https://api.github.com/repos/foundertherapy/engineering-task/assignees{/user}","branches_url":"https://api.github.com/repos/foundertherapy/engineering-task/branches{/branch}","tags_url":"https://api.github.com/repos/foundertherapy/engineering-task/tags","blobs_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/refs{/sha}","trees_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foundertherapy/engineering-task/statuses/{sha}","languages_url":"https://api.github.com/repos/foundertherapy/engineering-task/languages","stargazers_url":"https://api.github.com/repos/foundertherapy/engineering-task/stargazers","contributors_url":"https://api.github.com/repos/foundertherapy/engineering-task/contributors","subscribers_url":"https://api.github.com/repos/foundertherapy/engineering-task/subscribers","subscription_url":"https://api.github.com/repos/foundertherapy/engineering-task/subscription","commits_url":"https://api.github.com/repos/foundertherapy/engineering-task/commits{/sha}","git_commits_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/commits{/sha}","comments_url":"https://api.github.com/repos/foundertherapy/engineering-task/comments{/number}","issue_comment_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues/comments{/number}","contents_url":"https://api.github.com/repos/foundertherapy/engineering-task/contents/{+path}","compare_url":"https://api.github.com/repos/foundertherapy/engineering-task/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foundertherapy/engineering-task/merges","archive_url":"https://api.github.com/repos/foundertherapy/engineering-task/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foundertherapy/engineering-task/downloads","issues_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues{/number}","pulls_url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls{/number}","milestones_url":"https://api.github.com/repos/foundertherapy/engineering-task/milestones{/number}","notifications_url":"https://api.github.com/repos/foundertherapy/engineering-task/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foundertherapy/engineering-task/labels{/name}","releases_url":"https://api.github.com/repos/foundertherapy/engineering-task/releases{/id}","deployments_url":"https://api.github.com/repos/foundertherapy/engineering-task/deployments","created_at":"2019-04-20T13:22:09Z","updated_at":"2019-04-20T14:36:33Z","pushed_at":"2019-04-20T14:58:49Z","git_url":"git://github.com/foundertherapy/engineering-task.git","ssh_url":"git@github.com:foundertherapy/engineering-task.git","clone_url":"https://github.com/foundertherapy/engineering-task.git","svn_url":"https://github.com/foundertherapy/engineering-task","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"foundertherapy:master","ref":"master","sha":"ee1a2dcfdfeeaed7d24b8ba2ef1a933cb8248451","user":{"login":"foundertherapy","id":8397367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgzOTczNjc=","avatar_url":"https://avatars3.githubusercontent.com/u/8397367?v=4","gravatar_id":"","url":"https://api.github.com/users/foundertherapy","html_url":"https://github.com/foundertherapy","followers_url":"https://api.github.com/users/foundertherapy/followers","following_url":"https://api.github.com/users/foundertherapy/following{/other_user}","gists_url":"https://api.github.com/users/foundertherapy/gists{/gist_id}","starred_url":"https://api.github.com/users/foundertherapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foundertherapy/subscriptions","organizations_url":"https://api.github.com/users/foundertherapy/orgs","repos_url":"https://api.github.com/users/foundertherapy/repos","events_url":"https://api.github.com/users/foundertherapy/events{/privacy}","received_events_url":"https://api.github.com/users/foundertherapy/received_events","type":"Organization","site_admin":false},"repo":{"id":182408737,"node_id":"MDEwOlJlcG9zaXRvcnkxODI0MDg3Mzc=","name":"engineering-task","full_name":"foundertherapy/engineering-task","private":false,"owner":{"login":"foundertherapy","id":8397367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgzOTczNjc=","avatar_url":"https://avatars3.githubusercontent.com/u/8397367?v=4","gravatar_id":"","url":"https://api.github.com/users/foundertherapy","html_url":"https://github.com/foundertherapy","followers_url":"https://api.github.com/users/foundertherapy/followers","following_url":"https://api.github.com/users/foundertherapy/following{/other_user}","gists_url":"https://api.github.com/users/foundertherapy/gists{/gist_id}","starred_url":"https://api.github.com/users/foundertherapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foundertherapy/subscriptions","organizations_url":"https://api.github.com/users/foundertherapy/orgs","repos_url":"https://api.github.com/users/foundertherapy/repos","events_url":"https://api.github.com/users/foundertherapy/events{/privacy}","received_events_url":"https://api.github.com/users/foundertherapy/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/foundertherapy/engineering-task","description":null,"fork":false,"url":"https://api.github.com/repos/foundertherapy/engineering-task","forks_url":"https://api.github.com/repos/foundertherapy/engineering-task/forks","keys_url":"https://api.github.com/repos/foundertherapy/engineering-task/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foundertherapy/engineering-task/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foundertherapy/engineering-task/teams","hooks_url":"https://api.github.com/repos/foundertherapy/engineering-task/hooks","issue_events_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues/events{/number}","events_url":"https://api.github.com/repos/foundertherapy/engineering-task/events","assignees_url":"https://api.github.com/repos/foundertherapy/engineering-task/assignees{/user}","branches_url":"https://api.github.com/repos/foundertherapy/engineering-task/branches{/branch}","tags_url":"https://api.github.com/repos/foundertherapy/engineering-task/tags","blobs_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/refs{/sha}","trees_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foundertherapy/engineering-task/statuses/{sha}","languages_url":"https://api.github.com/repos/foundertherapy/engineering-task/languages","stargazers_url":"https://api.github.com/repos/foundertherapy/engineering-task/stargazers","contributors_url":"https://api.github.com/repos/foundertherapy/engineering-task/contributors","subscribers_url":"https://api.github.com/repos/foundertherapy/engineering-task/subscribers","subscription_url":"https://api.github.com/repos/foundertherapy/engineering-task/subscription","commits_url":"https://api.github.com/repos/foundertherapy/engineering-task/commits{/sha}","git_commits_url":"https://api.github.com/repos/foundertherapy/engineering-task/git/commits{/sha}","comments_url":"https://api.github.com/repos/foundertherapy/engineering-task/comments{/number}","issue_comment_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues/comments{/number}","contents_url":"https://api.github.com/repos/foundertherapy/engineering-task/contents/{+path}","compare_url":"https://api.github.com/repos/foundertherapy/engineering-task/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foundertherapy/engineering-task/merges","archive_url":"https://api.github.com/repos/foundertherapy/engineering-task/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foundertherapy/engineering-task/downloads","issues_url":"https://api.github.com/repos/foundertherapy/engineering-task/issues{/number}","pulls_url":"https://api.github.com/repos/foundertherapy/engineering-task/pulls{/number}","milestones_url":"https://api.github.com/repos/foundertherapy/engineering-task/milestones{/number}","notifications_url":"https://api.github.com/repos/foundertherapy/engineering-task/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foundertherapy/engineering-task/labels{/name}","releases_url":"https://api.github.com/repos/foundertherapy/engineering-task/releases{/id}","deployments_url":"https://api.github.com/repos/foundertherapy/engineering-task/deployments","created_at":"2019-04-20T13:22:09Z","updated_at":"2019-04-20T14:36:33Z","pushed_at":"2019-04-20T14:58:49Z","git_url":"git://github.com/foundertherapy/engineering-task.git","ssh_url":"git@github.com:foundertherapy/engineering-task.git","clone_url":"https://github.com/foundertherapy/engineering-task.git","svn_url":"https://github.com/foundertherapy/engineering-task","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1"},"html":{"href":"https://github.com/foundertherapy/engineering-task/pull/1"},"issue":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/issues/1"},"comments":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/foundertherapy/engineering-task/statuses/c59b80b927a32cb2eacbc57845d7327e96ef52f8"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"waseem-omar"}}