Что может привести к тому, что оператор if в шаблоне Django ничего не изменит?

Я пытаюсь вывести сообщение, когда пользователь нажимает кнопку Close Listing на моей веб-странице. В настоящее время при нажатии на кнопку с веб-страницей ничего не происходит. Как я могу это исправить и что не так?

часть файла views.py

#close listing code
    if sellar == request.user:
        closeListingButton = True
    else: 
        closeListingButton = False
    closeListing = ''
    try:
        has_closed = get_list_or_404(CloseListing, Q(
            user=request.user) & Q(listings=listing))
    except:
        has_closed = False
    if has_closed:
        closeListing = False
    else: 
        closeListing = True
    
  #what happens if listing is closed
        if closeListing == True:
            closeListingButton = False
            has_watchlists.delete()
            winner = max_bid.user
            return render(request, "auctions/listing.html",{
                        "auction_listing": listing,
                        "comments": comment_obj,
                        "bids": bid_obj,
                        "closeListingButton": closeListingButton,
                        "closeListing": closeListing,
                        "closedMessage": "This listing is closed.",
                        "winner": winner
            })
        else: 
            return redirect('listing', id=id)

часть listing.html

<!--close listing code-->
    {% if closeListing == True %}
        <div>{{ closedMessage }}
            <br>
            {{ winner }} has won the auction!
        </div>
    {% endif %}
Вернуться на верх