def comments(request, thread_id=None):

    this_submission = get_object_or_404(Submission, id=thread_id)

    thread_comments = Comment.objects.filter(submission=this_submission)

    if request.user.is_authenticated():
        try:
            reddit_user = RedditUser.objects.get(user=request.user)
        except RedditUser.DoesNotExist:
            reddit_user = None
    else:
        reddit_user = None

    sub_vote_value = None
    comment_votes = {}

    if reddit_user:

        try:
            vote = Vote.objects.get(
                vote_object_type=this_submission.get_content_type(),
                vote_object_id=this_submission.id,
                user=reddit_user)
            sub_vote_value = vote.value
        except Vote.DoesNotExist:
            pass

        try:
            user_thread_votes = Vote.objects.filter(user=reddit_user,
                                                    submission=this_submission)

            for vote in user_thread_votes:
                comment_votes[vote.vote_object.id] = vote.value
        except:
            pass

    return render(request, 'public/comments.html',
                  {'submission'   : this_submission,
                   'comments'     : thread_comments,
                   'comment_votes': comment_votes,
                   'sub_vote'     : sub_vote_value})
Sets the frame's icon.
dataset/ETHPy150Open Nikola-K/django_reddit/reddit/views.py/comments--crossover with--dataset/ETHPy150Open enthought/traitsui/traitsui/wx/ui_base.py/BaseDialog.set_icon