def can_delete(article, user): return not user.is_anonymous() and settings.CAN_DELETE(article, user)
def can_delete(article, user): if callable(settings.CAN_DELETE): return settings.CAN_DELETE(article, user) return not user.is_anonymous() and article.can_write(user)
def can_delete(article, user): if isinstance(settings.CAN_DELETE, collections.Callable): return settings.CAN_DELETE(article, user) return not user.is_anonymous() and article.can_write(user)