Пример #1
0
def comment_is_pinned(comment_details, viewer):
    """
    `viewer` should be request.user - the user viewing the comment.

    Returns "pinned" if pinned, else None.
    """
    if not isinstance(comment_details, CommentDetails):
        comment_details = CommentDetails(comment_details)
    return 'pinned' if comment_details.is_pinned(viewer) else None