def checkAccess(user, obj): check_meth = getattr(obj, 'checkAccess', False) if check_meth: return check_meth(user) else: return user.is_staff