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 @@
{% if auction_bids %}
{% for bid in auction_bids %}
<li><img src="" alt="">
<p>{{user_profile}} offered {{ bid.amount }}</p>
<p>{{bid.boodleuserid.displayname}} offered {{ bid.amount }}</p>
<p> &nbsp | &nbsp </p>
<p>{{bid.bidtime | timesince}} ago </p>
......
......@@ -25,6 +25,7 @@
</div>
<!--Change auctions_now, auction to like favorites, favorite-->
<h2> Items {{displayname}} bid on </h2>
<div class="event-container">
{% if auctionsOfUser %}
{% for id in idsOfAuction %}
......@@ -36,10 +37,10 @@
</a>
<p>{{ id.auctionend }}</p>
</div>
<input type="submit" value="remove auction">
<!-- if button is clidked -->
<!-- id rmeove from ids of auctions -->
{% comment %} <form action="" method="POST">
{% csrf_token %}
<input type="submit" name="remove-auction" value="remove auction">
</form> {% endcomment %}
</div>
{% endfor %}
......
......@@ -40,11 +40,10 @@ def auction(request,pk):
# Auction bids
auction_bids = AuctionBid.objects.filter(auctionid=pk).order_by('-bidtime')
highest_bid = auction_item.floorprice
# get boodle user ID
# who you are logged in as
users = BoodleUser.objects.get(userid=3)
userid = users.userid
# getting the user name
# user_profile = users.displayname
if auction_bids:
highest_bid = auction_bids[0].amount
......@@ -72,14 +71,13 @@ def auction(request,pk):
'item_floor_price': auction_item.floorprice,
'highest_bid': highest_bid,
'auction_end': auction.auctionend,
'user_profile': users.displayname,
'user_profile': userid,
'form' : form,
}
if auction.auctionend < datetime.now():
return HttpResponse("This auction has already passed.")
elif auction.auctionstart > datetime.now():
#return HttpResponse("This auction has not yet started.")
return render(request, "boodlesite/templates/error404/notstarted_error404.html")
else:
return render(request, "boodlesite/templates/auction.html",context)
......@@ -176,6 +174,7 @@ def profile(request, pk):
if bid.auctionid == auction:
idsOfAuction.append(bid.auctionid)
# print(auction.title)
# print(bid.auctionid)
# print("===============") #divider between auctions :3
......@@ -187,6 +186,13 @@ def profile(request, pk):
# for auction in auctionsOfUser:
# print(auction)
# for bid in bidsByUser:
# for auction in auctionsOfUser:
# if bid.auctionid == auction:
for i in idsOfAuction:
print(i)
context = {
'displayname': current_user.displayname,
'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