{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/mentorship/pulls/comments/69285039","id":69285039,"diff_hunk":"@@ -133,12 +134,30 @@ def create(self, validated_data):\n         return mentee\n \n \n+class ProfilePicUrlField(serializers.Field):\n+    \"\"\"A read-only field for returning an appropriate ProfilePic URL.\"\"\"\n+\n+    def to_representation(self, value):\n+        if not value:\n+            return None\n+        url = \"%s%s\" % (\n+            reverse(\n+                'mentor-profile-detail', kwargs={'pk': value.instance.pk}),\n+            'image/')\n+        request = self.context.get('request', None)\n+        if request is not None:\n+            return request.build_absolute_uri(url)\n+        return url\n+\n+\n class ProfileSerializer(serializers.ModelSerializer):\n \n-        class Meta:\n-            model = Mentor\n-            fields = ('job_sector', 'job_title',\n-                      'motivation', 'inspiration', 'tags')\n+    profile_pic = ProfilePicUrlField(required=False, read_only=True)","path":"mentorship/mentor/serializers.py","position":34,"original_position":34,"commit_id":"f54a4f6edfa570601f9969f341f4d71e802cf3a3","original_commit_id":"f54a4f6edfa570601f9969f341f4d71e802cf3a3","user":{"login":"hodgestar","id":165551,"avatar_url":"https://avatars.githubusercontent.com/u/165551?v=3","gravatar_id":"","url":"https://api.github.com/users/hodgestar","html_url":"https://github.com/hodgestar","followers_url":"https://api.github.com/users/hodgestar/followers","following_url":"https://api.github.com/users/hodgestar/following{/other_user}","gists_url":"https://api.github.com/users/hodgestar/gists{/gist_id}","starred_url":"https://api.github.com/users/hodgestar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hodgestar/subscriptions","organizations_url":"https://api.github.com/users/hodgestar/orgs","repos_url":"https://api.github.com/users/hodgestar/repos","events_url":"https://api.github.com/users/hodgestar/events{/privacy}","received_events_url":"https://api.github.com/users/hodgestar/received_events","type":"User","site_admin":false},"body":"There doesn't seem to be a way to get a URL for a detail route on a view (i.e. adding the `image/` on the end). We could override `HyperlinkedIdentityField` instead of `Field`. We'd still have to override `to_representation`, but maybe it'd be a bit shorter. Let me try quickly.","created_at":"2016-07-01T11:17:26Z","updated_at":"2016-07-01T11:17:26Z","html_url":"https://github.com/praekelt/mentorship/pull/81#discussion_r69285039","pull_request_url":"https://api.github.com/repos/praekelt/mentorship/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/praekelt/mentorship/pulls/comments/69285039"},"html":{"href":"https://github.com/praekelt/mentorship/pull/81#discussion_r69285039"},"pull_request":{"href":"https://api.github.com/repos/praekelt/mentorship/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/mentorship/pulls/81","id":75961112,"html_url":"https://github.com/praekelt/mentorship/pull/81","diff_url":"https://github.com/praekelt/mentorship/pull/81.diff","patch_url":"https://github.com/praekelt/mentorship/pull/81.patch","issue_url":"https://api.github.com/repos/praekelt/mentorship/issues/81","number":81,"state":"open","locked":false,"title":"Return the profile pic URL","user":{"login":"hodgestar","id":165551,"avatar_url":"https://avatars.githubusercontent.com/u/165551?v=3","gravatar_id":"","url":"https://api.github.com/users/hodgestar","html_url":"https://github.com/hodgestar","followers_url":"https://api.github.com/users/hodgestar/followers","following_url":"https://api.github.com/users/hodgestar/following{/other_user}","gists_url":"https://api.github.com/users/hodgestar/gists{/gist_id}","starred_url":"https://api.github.com/users/hodgestar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hodgestar/subscriptions","organizations_url":"https://api.github.com/users/hodgestar/orgs","repos_url":"https://api.github.com/users/hodgestar/repos","events_url":"https://api.github.com/users/hodgestar/events{/privacy}","received_events_url":"https://api.github.com/users/hodgestar/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-07-01T10:43:31Z","updated_at":"2016-07-01T11:17:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f8b13309a49661f449f86165624db57efdddf3f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/mentorship/pulls/81/commits","review_comments_url":"https://api.github.com/repos/praekelt/mentorship/pulls/81/comments","review_comment_url":"https://api.github.com/repos/praekelt/mentorship/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/mentorship/issues/81/comments","statuses_url":"https://api.github.com/repos/praekelt/mentorship/statuses/f54a4f6edfa570601f9969f341f4d71e802cf3a3","head":{"label":"praekelt:feature/issue-64-return-location-of-profile-picture","ref":"feature/issue-64-return-location-of-profile-picture","sha":"f54a4f6edfa570601f9969f341f4d71e802cf3a3","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":44984280,"name":"mentorship","full_name":"praekelt/mentorship","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/mentorship","description":"","fork":false,"url":"https://api.github.com/repos/praekelt/mentorship","forks_url":"https://api.github.com/repos/praekelt/mentorship/forks","keys_url":"https://api.github.com/repos/praekelt/mentorship/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/mentorship/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/mentorship/teams","hooks_url":"https://api.github.com/repos/praekelt/mentorship/hooks","issue_events_url":"https://api.github.com/repos/praekelt/mentorship/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/mentorship/events","assignees_url":"https://api.github.com/repos/praekelt/mentorship/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/mentorship/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/mentorship/tags","blobs_url":"https://api.github.com/repos/praekelt/mentorship/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/mentorship/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/mentorship/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/mentorship/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/mentorship/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/mentorship/languages","stargazers_url":"https://api.github.com/repos/praekelt/mentorship/stargazers","contributors_url":"https://api.github.com/repos/praekelt/mentorship/contributors","subscribers_url":"https://api.github.com/repos/praekelt/mentorship/subscribers","subscription_url":"https://api.github.com/repos/praekelt/mentorship/subscription","commits_url":"https://api.github.com/repos/praekelt/mentorship/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/mentorship/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/mentorship/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/mentorship/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/mentorship/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/mentorship/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/mentorship/merges","archive_url":"https://api.github.com/repos/praekelt/mentorship/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/mentorship/downloads","issues_url":"https://api.github.com/repos/praekelt/mentorship/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/mentorship/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/mentorship/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/mentorship/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/mentorship/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/mentorship/releases{/id}","deployments_url":"https://api.github.com/repos/praekelt/mentorship/deployments","created_at":"2015-10-26T17:07:23Z","updated_at":"2016-02-17T11:50:23Z","pushed_at":"2016-07-01T11:01:41Z","git_url":"git://github.com/praekelt/mentorship.git","ssh_url":"git@github.com:praekelt/mentorship.git","clone_url":"https://github.com/praekelt/mentorship.git","svn_url":"https://github.com/praekelt/mentorship","homepage":null,"size":2171,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":1,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"79c9150af1532775c73f33f56cbfda1cfe602854","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":44984280,"name":"mentorship","full_name":"praekelt/mentorship","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/mentorship","description":"","fork":false,"url":"https://api.github.com/repos/praekelt/mentorship","forks_url":"https://api.github.com/repos/praekelt/mentorship/forks","keys_url":"https://api.github.com/repos/praekelt/mentorship/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/mentorship/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/mentorship/teams","hooks_url":"https://api.github.com/repos/praekelt/mentorship/hooks","issue_events_url":"https://api.github.com/repos/praekelt/mentorship/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/mentorship/events","assignees_url":"https://api.github.com/repos/praekelt/mentorship/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/mentorship/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/mentorship/tags","blobs_url":"https://api.github.com/repos/praekelt/mentorship/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/mentorship/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/mentorship/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/mentorship/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/mentorship/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/mentorship/languages","stargazers_url":"https://api.github.com/repos/praekelt/mentorship/stargazers","contributors_url":"https://api.github.com/repos/praekelt/mentorship/contributors","subscribers_url":"https://api.github.com/repos/praekelt/mentorship/subscribers","subscription_url":"https://api.github.com/repos/praekelt/mentorship/subscription","commits_url":"https://api.github.com/repos/praekelt/mentorship/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/mentorship/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/mentorship/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/mentorship/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/mentorship/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/mentorship/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/mentorship/merges","archive_url":"https://api.github.com/repos/praekelt/mentorship/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/mentorship/downloads","issues_url":"https://api.github.com/repos/praekelt/mentorship/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/mentorship/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/mentorship/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/mentorship/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/mentorship/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/mentorship/releases{/id}","deployments_url":"https://api.github.com/repos/praekelt/mentorship/deployments","created_at":"2015-10-26T17:07:23Z","updated_at":"2016-02-17T11:50:23Z","pushed_at":"2016-07-01T11:01:41Z","git_url":"git://github.com/praekelt/mentorship.git","ssh_url":"git@github.com:praekelt/mentorship.git","clone_url":"https://github.com/praekelt/mentorship.git","svn_url":"https://github.com/praekelt/mentorship","homepage":null,"size":2171,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/mentorship/pulls/81"},"html":{"href":"https://github.com/praekelt/mentorship/pull/81"},"issue":{"href":"https://api.github.com/repos/praekelt/mentorship/issues/81"},"comments":{"href":"https://api.github.com/repos/praekelt/mentorship/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/mentorship/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/mentorship/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/mentorship/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/mentorship/statuses/f54a4f6edfa570601f9969f341f4d71e802cf3a3"}}}}
{"actor":{"display_login":"hodgestar"}}