def test_func(self): """Tests if user is_active and is_staff/is_superuser""" logger.debug( # prints class and function name f"{self.__class__.__name__}.{_getframe().f_code.co_name} " f"Testing {self.request.user} status") obj = self.get_object() # tests if the user is the same as the object he is trying to view is_owner = (obj == self.request.user) and self.request.user.is_active return is_owner or test_user(self.request.user)
def test_func(self): """Tests if user is_active and is_staff/is_superuser""" logger.debug( # prints class and function name f"{self.__class__.__name__}.{_getframe().f_code.co_name} " f"Testing {self.request.user} status") return test_user(self.request.user)