{"action":"created","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2690","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2690/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2690/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2690/events","html_url":"https://github.com/tomchristie/django-rest-framework/pull/2690","id":61093888,"number":2690,"title":"Use callable source for HyperlinkedRelatedField","user":{"login":"delinhabit","id":426711,"avatar_url":"https://avatars.githubusercontent.com/u/426711?v=3","gravatar_id":"","url":"https://api.github.com/users/delinhabit","html_url":"https://github.com/delinhabit","followers_url":"https://api.github.com/users/delinhabit/followers","following_url":"https://api.github.com/users/delinhabit/following{/other_user}","gists_url":"https://api.github.com/users/delinhabit/gists{/gist_id}","starred_url":"https://api.github.com/users/delinhabit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delinhabit/subscriptions","organizations_url":"https://api.github.com/users/delinhabit/orgs","repos_url":"https://api.github.com/users/delinhabit/repos","events_url":"https://api.github.com/users/delinhabit/events{/privacy}","received_events_url":"https://api.github.com/users/delinhabit/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/labels/Needs%20further%20review","name":"Needs further review","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-13T15:17:13Z","updated_at":"2015-06-24T14:19:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/pulls/2690","html_url":"https://github.com/tomchristie/django-rest-framework/pull/2690","diff_url":"https://github.com/tomchristie/django-rest-framework/pull/2690.diff","patch_url":"https://github.com/tomchristie/django-rest-framework/pull/2690.patch"},"body":"Currently you cannot use a callable source for a `HyperlinkedRelatedField `. I added a test to reproduce the issue.\r\n\r\nThe problem comes from the `PKOnlyObject` optimization. The `value` passed to the serialization method ([here](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/relations.py#L240)) is a `PKOnlyObject` instance on which the `pk` attribute is the callable configured as the source. Because of that, the URL reversal fails.\r\n\r\nAm I trying to do something illegal? I'm happy to fix the issue if we confirm this is a valid case that is failing.\r\n\r\nThanks!\r\n"},"comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/comments/114884334","html_url":"https://github.com/tomchristie/django-rest-framework/pull/2690#issuecomment-114884334","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2690","id":114884334,"user":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars.githubusercontent.com/u/647359?v=3","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T14:19:47Z","updated_at":"2015-06-24T14:19:47Z","body":"Next step to progress this issue - is this the case with all related fields?"}}