def is_following_board(user, board): is_authenticated = getattr(user, 'is_authenticated', None) if (is_authenticated and is_authenticated()) or not is_authenticated: user_pk = getattr(user, 'pk', user) board_pk = getattr(board, 'pk') return (follow.is_following_user(user_pk, board.user.pk) and not follow.is_unfollowing_board(user_pk, board_pk)) \ or follow.is_following_board(user_pk, board_pk)
def is_following_user(user, followee): is_authenticated = getattr(user, 'is_authenticated', None) if (is_authenticated and is_authenticated()) or not is_authenticated: user_pk = getattr(user, 'pk', user) followee_pk = getattr(followee, 'pk', followee) return follow.is_following_user(user_pk, followee_pk)