{"action":"created","comment":{"url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/comments/30454859","id":30454859,"diff_hunk":"@@ -42,6 +42,9 @@ def field_to_native(self, obj, field_name):\n         Delegates to the `to_native` method of the serializer registered\n         under obj.__class__\n         \"\"\"\n+        if not (obj and getattr(obj, field_name)):","path":"generic_relations/relations.py","position":4,"original_position":4,"commit_id":"55ff4b6bc948b5fd9d913c2a41576d3dc641f6cc","original_commit_id":"55ff4b6bc948b5fd9d913c2a41576d3dc641f6cc","user":{"login":"smcoll","id":321438,"avatar_url":"https://avatars.githubusercontent.com/u/321438?v=3","gravatar_id":"","url":"https://api.github.com/users/smcoll","html_url":"https://github.com/smcoll","followers_url":"https://api.github.com/users/smcoll/followers","following_url":"https://api.github.com/users/smcoll/following{/other_user}","gists_url":"https://api.github.com/users/smcoll/gists{/gist_id}","starred_url":"https://api.github.com/users/smcoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smcoll/subscriptions","organizations_url":"https://api.github.com/users/smcoll/orgs","repos_url":"https://api.github.com/users/smcoll/repos","events_url":"https://api.github.com/users/smcoll/events{/privacy}","received_events_url":"https://api.github.com/users/smcoll/received_events","type":"User","site_admin":false},"body":"On second thought, this really is another issue and may not be warranted here.  i had another case where 'field_name' was a key in a dictionary, as the object returned was a dictionary.  In that case, i just made a subclass of this serializer that handled the different behavior in this method.  My vote is just to handle a `None` value for object here, and not worry about a `None` value for obj.field_name at least until another issue is raised independently.\r\n\r\nHow's that sound?  Anything else i will need to take care of before this can be accepted?","created_at":"2015-05-15T23:55:37Z","updated_at":"2015-05-15T23:55:37Z","html_url":"https://github.com/Ian-Foote/rest-framework-generic-relations/pull/10#discussion_r30454859","pull_request_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/comments/30454859"},"html":{"href":"https://github.com/Ian-Foote/rest-framework-generic-relations/pull/10#discussion_r30454859"},"pull_request":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10","id":35370576,"html_url":"https://github.com/Ian-Foote/rest-framework-generic-relations/pull/10","diff_url":"https://github.com/Ian-Foote/rest-framework-generic-relations/pull/10.diff","patch_url":"https://github.com/Ian-Foote/rest-framework-generic-relations/pull/10.patch","issue_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues/10","number":10,"state":"open","locked":false,"title":"Fix for #3, with tests","user":{"login":"smcoll","id":321438,"avatar_url":"https://avatars.githubusercontent.com/u/321438?v=3","gravatar_id":"","url":"https://api.github.com/users/smcoll","html_url":"https://github.com/smcoll","followers_url":"https://api.github.com/users/smcoll/followers","following_url":"https://api.github.com/users/smcoll/following{/other_user}","gists_url":"https://api.github.com/users/smcoll/gists{/gist_id}","starred_url":"https://api.github.com/users/smcoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smcoll/subscriptions","organizations_url":"https://api.github.com/users/smcoll/orgs","repos_url":"https://api.github.com/users/smcoll/repos","events_url":"https://api.github.com/users/smcoll/events{/privacy}","received_events_url":"https://api.github.com/users/smcoll/received_events","type":"User","site_admin":false},"body":"Support for nullable GenericForeignKey relations, with tests.  Fix for upstream #3\r\n\r\nThanks to @turukawa for the implementation","created_at":"2015-05-13T21:04:34Z","updated_at":"2015-05-15T23:55:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3209dcfdc4a0ae37555b90fdf460be16745a4c18","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10/commits","review_comments_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10/comments","review_comment_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues/10/comments","statuses_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/statuses/55ff4b6bc948b5fd9d913c2a41576d3dc641f6cc","head":{"label":"smcoll:hotfix/upstream-3","ref":"hotfix/upstream-3","sha":"55ff4b6bc948b5fd9d913c2a41576d3dc641f6cc","user":{"login":"smcoll","id":321438,"avatar_url":"https://avatars.githubusercontent.com/u/321438?v=3","gravatar_id":"","url":"https://api.github.com/users/smcoll","html_url":"https://github.com/smcoll","followers_url":"https://api.github.com/users/smcoll/followers","following_url":"https://api.github.com/users/smcoll/following{/other_user}","gists_url":"https://api.github.com/users/smcoll/gists{/gist_id}","starred_url":"https://api.github.com/users/smcoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smcoll/subscriptions","organizations_url":"https://api.github.com/users/smcoll/orgs","repos_url":"https://api.github.com/users/smcoll/repos","events_url":"https://api.github.com/users/smcoll/events{/privacy}","received_events_url":"https://api.github.com/users/smcoll/received_events","type":"User","site_admin":false},"repo":{"id":35388105,"name":"rest-framework-generic-relations","full_name":"smcoll/rest-framework-generic-relations","owner":{"login":"smcoll","id":321438,"avatar_url":"https://avatars.githubusercontent.com/u/321438?v=3","gravatar_id":"","url":"https://api.github.com/users/smcoll","html_url":"https://github.com/smcoll","followers_url":"https://api.github.com/users/smcoll/followers","following_url":"https://api.github.com/users/smcoll/following{/other_user}","gists_url":"https://api.github.com/users/smcoll/gists{/gist_id}","starred_url":"https://api.github.com/users/smcoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smcoll/subscriptions","organizations_url":"https://api.github.com/users/smcoll/orgs","repos_url":"https://api.github.com/users/smcoll/repos","events_url":"https://api.github.com/users/smcoll/events{/privacy}","received_events_url":"https://api.github.com/users/smcoll/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/smcoll/rest-framework-generic-relations","description":"","fork":true,"url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations","forks_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/forks","keys_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/teams","hooks_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/hooks","issue_events_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/issues/events{/number}","events_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/events","assignees_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/assignees{/user}","branches_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/branches{/branch}","tags_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/tags","blobs_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/git/refs{/sha}","trees_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/statuses/{sha}","languages_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/languages","stargazers_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/stargazers","contributors_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/contributors","subscribers_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/subscribers","subscription_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/subscription","commits_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/commits{/sha}","git_commits_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/git/commits{/sha}","comments_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/comments{/number}","issue_comment_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/issues/comments{/number}","contents_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/contents/{+path}","compare_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/merges","archive_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/downloads","issues_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/issues{/number}","pulls_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/pulls{/number}","milestones_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/milestones{/number}","notifications_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/labels{/name}","releases_url":"https://api.github.com/repos/smcoll/rest-framework-generic-relations/releases{/id}","created_at":"2015-05-10T21:07:45Z","updated_at":"2015-05-10T21:07:45Z","pushed_at":"2015-05-14T15:37:12Z","git_url":"git://github.com/smcoll/rest-framework-generic-relations.git","ssh_url":"git@github.com:smcoll/rest-framework-generic-relations.git","clone_url":"https://github.com/smcoll/rest-framework-generic-relations.git","svn_url":"https://github.com/smcoll/rest-framework-generic-relations","homepage":null,"size":107,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Ian-Foote:master","ref":"master","sha":"ff307d3d68be1fb5d2a6bfa471751a6bc84239b7","user":{"login":"Ian-Foote","id":1843202,"avatar_url":"https://avatars.githubusercontent.com/u/1843202?v=3","gravatar_id":"","url":"https://api.github.com/users/Ian-Foote","html_url":"https://github.com/Ian-Foote","followers_url":"https://api.github.com/users/Ian-Foote/followers","following_url":"https://api.github.com/users/Ian-Foote/following{/other_user}","gists_url":"https://api.github.com/users/Ian-Foote/gists{/gist_id}","starred_url":"https://api.github.com/users/Ian-Foote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ian-Foote/subscriptions","organizations_url":"https://api.github.com/users/Ian-Foote/orgs","repos_url":"https://api.github.com/users/Ian-Foote/repos","events_url":"https://api.github.com/users/Ian-Foote/events{/privacy}","received_events_url":"https://api.github.com/users/Ian-Foote/received_events","type":"User","site_admin":false},"repo":{"id":18703934,"name":"rest-framework-generic-relations","full_name":"Ian-Foote/rest-framework-generic-relations","owner":{"login":"Ian-Foote","id":1843202,"avatar_url":"https://avatars.githubusercontent.com/u/1843202?v=3","gravatar_id":"","url":"https://api.github.com/users/Ian-Foote","html_url":"https://github.com/Ian-Foote","followers_url":"https://api.github.com/users/Ian-Foote/followers","following_url":"https://api.github.com/users/Ian-Foote/following{/other_user}","gists_url":"https://api.github.com/users/Ian-Foote/gists{/gist_id}","starred_url":"https://api.github.com/users/Ian-Foote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ian-Foote/subscriptions","organizations_url":"https://api.github.com/users/Ian-Foote/orgs","repos_url":"https://api.github.com/users/Ian-Foote/repos","events_url":"https://api.github.com/users/Ian-Foote/events{/privacy}","received_events_url":"https://api.github.com/users/Ian-Foote/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Ian-Foote/rest-framework-generic-relations","description":"","fork":false,"url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations","forks_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/forks","keys_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/teams","hooks_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/hooks","issue_events_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues/events{/number}","events_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/events","assignees_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/assignees{/user}","branches_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/branches{/branch}","tags_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/tags","blobs_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/statuses/{sha}","languages_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/languages","stargazers_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/stargazers","contributors_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/contributors","subscribers_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/subscribers","subscription_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/subscription","commits_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/contents/{+path}","compare_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/merges","archive_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/downloads","issues_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues{/number}","pulls_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls{/number}","milestones_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/milestones{/number}","notifications_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/labels{/name}","releases_url":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/releases{/id}","created_at":"2014-04-12T12:52:30Z","updated_at":"2015-05-11T23:10:44Z","pushed_at":"2015-05-14T15:36:31Z","git_url":"git://github.com/Ian-Foote/rest-framework-generic-relations.git","ssh_url":"git@github.com:Ian-Foote/rest-framework-generic-relations.git","clone_url":"https://github.com/Ian-Foote/rest-framework-generic-relations.git","svn_url":"https://github.com/Ian-Foote/rest-framework-generic-relations","homepage":null,"size":240,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":4,"forks":6,"open_issues":4,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10"},"html":{"href":"https://github.com/Ian-Foote/rest-framework-generic-relations/pull/10"},"issue":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues/10"},"comments":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/Ian-Foote/rest-framework-generic-relations/statuses/55ff4b6bc948b5fd9d913c2a41576d3dc641f6cc"}}}}