From b270313f98b6fcf7f9777348103a09f3829dcaf8 Mon Sep 17 00:00:00 2001 From: lalanza808 Date: Sun, 12 Jan 2020 00:55:26 -0800 Subject: [PATCH] fix broken sale url in bids page --- bids/views.py | 4 +++- web/templates/bids/list_bids.html | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bids/views.py b/bids/views.py index 0f29af4..f6d8bdb 100644 --- a/bids/views.py +++ b/bids/views.py @@ -14,6 +14,7 @@ from core.monero import AuctionWallet def list_bids(request): page_query = request.GET.get('page', 1) bid_list = ItemBid.objects.filter(bidder=request.user) + sales = ItemSale.objects.filter(bid__in=bid_list) paginator = Paginator(bid_list, 20) try: @@ -24,7 +25,8 @@ def list_bids(request): bids = paginator.page(paginator.num_pages) context = { - 'bids': bids + 'bids': bids, + 'sales': sales } return render(request, 'bids/list_bids.html', context) diff --git a/web/templates/bids/list_bids.html b/web/templates/bids/list_bids.html index 622f9cb..0b2ea5d 100644 --- a/web/templates/bids/list_bids.html +++ b/web/templates/bids/list_bids.html @@ -19,6 +19,7 @@ Actions {% for bid in bids %} + #{{ bid.id }} {{ bid.bid_date | date:"d M, Y H:i:s" }} @@ -27,7 +28,11 @@ {{ bid.accepted }} {% if bid.accepted %} - View Sale + {% for sale in sales %} + {% if sale.bid.id == bid.id %} + View Sale + {% endif %} + {% endfor %} {% else %} Edit Delete