Merge pull request #2163 from rooftopcellist/related_token_endpoint

Add Related token link
This commit is contained in:
Christian Adams 2018-06-14 14:39:13 -04:00 committed by GitHub
commit 5ee4333fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1169,6 +1169,13 @@ class OAuth2ApplicationSerializer(BaseSerializer):
ret.pop('client_secret', None)
return ret
def get_related(self, obj):
res = super(OAuth2ApplicationSerializer, self).get_related(obj)
res.update(dict(
tokens = self.reverse('api:o_auth2_application_token_list', kwargs={'pk': obj.pk}),
))
return res
def get_modified(self, obj):
if obj is None:
return None