def is_admin(self, obj):
    request = self.context['request']
    if hasattr(obj, '_admin'):
        return obj._admin
    return obj.remote_repository_relations.filter(user=request.user, admin=True).exists()
def is_admin(self, obj):
    request = self.context['request']
    if hasattr(obj, '_admin'):
        return obj._admin
    return obj.remote_repository_relations.filter(user=request.user, admin=True).exists()