Displayed the name of the users who bid on the auction page.

Displayed the items the specific user has bid on.
To view items a specific user has bid on, one has to "log in" by  changing
users = BoodleUser.objects.get(userid=3)
and bidsByUser = AuctionBid.objects.filter
(boodleuserid=3).distinct('auctionid')
Co-authored-by: 's avatarpinkboheme <pinkboheme@users.noreply.github.com>
Co-authored-by: 's avatarChristine <cdeeerrr@users.noreply.github.com>
parent 8672b003
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
{% if auction_bids %} {% if auction_bids %}
{% for bid in auction_bids %} {% for bid in auction_bids %}
<li><img src="" alt=""> <li><img src="" alt="">
<p>{{user_profile}} offered {{ bid.amount }}</p> <p>{{bid.boodleuserid.displayname}} offered {{ bid.amount }}</p>
<p> &nbsp | &nbsp </p> <p> &nbsp | &nbsp </p>
<p>{{bid.bidtime | timesince}} ago </p> <p>{{bid.bidtime | timesince}} ago </p>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
</div> </div>
<!--Change auctions_now, auction to like favorites, favorite--> <!--Change auctions_now, auction to like favorites, favorite-->
<h2> Items {{displayname}} bid on </h2>
<div class="event-container"> <div class="event-container">
{% if auctionsOfUser %} {% if auctionsOfUser %}
{% for id in idsOfAuction %} {% for id in idsOfAuction %}
...@@ -36,10 +37,10 @@ ...@@ -36,10 +37,10 @@
</a> </a>
<p>{{ id.auctionend }}</p> <p>{{ id.auctionend }}</p>
</div> </div>
<input type="submit" value="remove auction"> {% comment %} <form action="" method="POST">
{% csrf_token %}
<!-- if button is clidked --> <input type="submit" name="remove-auction" value="remove auction">
<!-- id rmeove from ids of auctions --> </form> {% endcomment %}
</div> </div>
{% endfor %} {% endfor %}
......
...@@ -40,11 +40,10 @@ def auction(request,pk): ...@@ -40,11 +40,10 @@ def auction(request,pk):
# Auction bids # Auction bids
auction_bids = AuctionBid.objects.filter(auctionid=pk).order_by('-bidtime') auction_bids = AuctionBid.objects.filter(auctionid=pk).order_by('-bidtime')
highest_bid = auction_item.floorprice highest_bid = auction_item.floorprice
# get boodle user ID
# who you are logged in as
users = BoodleUser.objects.get(userid=3) users = BoodleUser.objects.get(userid=3)
userid = users.userid userid = users.userid
# getting the user name
# user_profile = users.displayname
if auction_bids: if auction_bids:
highest_bid = auction_bids[0].amount highest_bid = auction_bids[0].amount
...@@ -72,14 +71,13 @@ def auction(request,pk): ...@@ -72,14 +71,13 @@ def auction(request,pk):
'item_floor_price': auction_item.floorprice, 'item_floor_price': auction_item.floorprice,
'highest_bid': highest_bid, 'highest_bid': highest_bid,
'auction_end': auction.auctionend, 'auction_end': auction.auctionend,
'user_profile': users.displayname, 'user_profile': userid,
'form' : form, 'form' : form,
} }
if auction.auctionend < datetime.now(): if auction.auctionend < datetime.now():
return HttpResponse("This auction has already passed.") return HttpResponse("This auction has already passed.")
elif auction.auctionstart > datetime.now(): elif auction.auctionstart > datetime.now():
#return HttpResponse("This auction has not yet started.")
return render(request, "boodlesite/templates/error404/notstarted_error404.html") return render(request, "boodlesite/templates/error404/notstarted_error404.html")
else: else:
return render(request, "boodlesite/templates/auction.html",context) return render(request, "boodlesite/templates/auction.html",context)
...@@ -176,6 +174,7 @@ def profile(request, pk): ...@@ -176,6 +174,7 @@ def profile(request, pk):
if bid.auctionid == auction: if bid.auctionid == auction:
idsOfAuction.append(bid.auctionid) idsOfAuction.append(bid.auctionid)
# print(auction.title) # print(auction.title)
# print(bid.auctionid) # print(bid.auctionid)
# print("===============") #divider between auctions :3 # print("===============") #divider between auctions :3
...@@ -187,6 +186,13 @@ def profile(request, pk): ...@@ -187,6 +186,13 @@ def profile(request, pk):
# for auction in auctionsOfUser: # for auction in auctionsOfUser:
# print(auction) # print(auction)
# for bid in bidsByUser:
# for auction in auctionsOfUser:
# if bid.auctionid == auction:
for i in idsOfAuction:
print(i)
context = { context = {
'displayname': current_user.displayname, 'displayname': current_user.displayname,
'username':current_user.username, 'username':current_user.username,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment