{"action":"opened","issue":{"url":"https://api.github.com/repos/wimglenn/djangorestframework-queryfields/issues/1","repository_url":"https://api.github.com/repos/wimglenn/djangorestframework-queryfields","labels_url":"https://api.github.com/repos/wimglenn/djangorestframework-queryfields/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/wimglenn/djangorestframework-queryfields/issues/1/comments","events_url":"https://api.github.com/repos/wimglenn/djangorestframework-queryfields/issues/1/events","html_url":"https://github.com/wimglenn/djangorestframework-queryfields/issues/1","id":184898644,"number":1,"title":"Consider overriding to_representation instead of modifying self.fields","user":{"login":"fabiosussetto","id":103664,"avatar_url":"https://avatars.githubusercontent.com/u/103664?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiosussetto","html_url":"https://github.com/fabiosussetto","followers_url":"https://api.github.com/users/fabiosussetto/followers","following_url":"https://api.github.com/users/fabiosussetto/following{/other_user}","gists_url":"https://api.github.com/users/fabiosussetto/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiosussetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiosussetto/subscriptions","organizations_url":"https://api.github.com/users/fabiosussetto/orgs","repos_url":"https://api.github.com/users/fabiosussetto/repos","events_url":"https://api.github.com/users/fabiosussetto/events{/privacy}","received_events_url":"https://api.github.com/users/fabiosussetto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-24T17:03:25Z","updated_at":"2016-10-24T17:03:25Z","closed_at":null,"body":"Hey Wim, nice little useful package this one, I was surprised they don't support this out of the box. \r\n\r\nOne thing I'd consider is having your mixin override to_representation (http://www.django-rest-framework.org/api-guide/serializers/#baseserializer)  instead of manually popping the fields out of the serialiser instance. \r\nTo me this way has these two advantages:\r\n\r\n- It feels a bit \"cleaner\" as overriding to_representation seems the recommended way to change serialisation behaviour without affecting the serialiser behaviour in other contexts.\r\n- Popping the fields is \"destructive\" in the sense you wouldn't be able to reuse the same serialiser instance with the default behaviour. Inside to_representation you can access self.context and decide what to exclude from the output.\r\n\r\nCheers!\r\n"}}
{"actor":{"display_login":"fabiosussetto"}}