def get_parent(self): try: parent = self.request.user.parent except (AttributeError, exceptions.ObjectDoesNotExist): raise PermissionDenied(detail='Role incorrect') return parent