Commit 956452cb authored by Felizia Tiburcio's avatar Felizia Tiburcio

Display auction bids on auction page

parent 1b83d454
...@@ -10,120 +10,111 @@ a{% extends 'boodlesite\templates\base.html' %} ...@@ -10,120 +10,111 @@ a{% extends 'boodlesite\templates\base.html' %}
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-7 col-md-6"> <div class="col-lg-7 col-md-6">
product display div product display div
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel"> <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner"> <div class="carousel-inner">
<div class="carousel-item active"> <div class="carousel-item active">
<img class="d-block w-100" src="https://cdn.shopify.com/s/files/1/0502/6421/1616/products/Dream-Valentines-Heart-Beat-Pom-Pom-Beanie_-Limited-Edition-Dream-VD-ALL-Pom-Beanie-Heart_5000x.png?v=1643226660" alt="First slide"> <img class="d-block w-100"
</div> src="https://cdn.shopify.com/s/files/1/0502/6421/1616/products/Dream-Valentines-Heart-Beat-Pom-Pom-Beanie_-Limited-Edition-Dream-VD-ALL-Pom-Beanie-Heart_5000x.png?v=1643226660"
<div class="carousel-item"> alt="First slide">
<img class="d-block w-100" src="https://cdn.shopify.com/s/files/1/0502/6421/1616/products/Dream-VD-Black-Pom-Beanie-Heart_5000x.png?v=1643226660" alt="Second slide"> </div>
</div> <div class="carousel-item">
<div class="carousel-item"> <img class="d-block w-100"
<img class="d-block w-100" src="https://cdn.shopify.com/s/files/1/0502/6421/1616/products/Dream-VD-Pink-Pom-Beanie-Heart_5000x.png?v=1643226660" alt="Third slide"> src="https://cdn.shopify.com/s/files/1/0502/6421/1616/products/Dream-VD-Black-Pom-Beanie-Heart_5000x.png?v=1643226660"
</div> alt="Second slide">
</div> </div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev"> <div class="carousel-item">
<span class="carousel-control-prev-icon" aria-hidden="true"></span> <img class="d-block w-100"
<span class="sr-only">Previous</span> src="https://cdn.shopify.com/s/files/1/0502/6421/1616/products/Dream-VD-Pink-Pom-Beanie-Heart_5000x.png?v=1643226660"
</a> alt="Third slide">
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next"> </div>
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!-- <img src="https://thumbs.dreamstime.com/b/toy-teddy-bear-isolated-white-background-40677685.jpg"> -->
</div> </div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!-- <img src="https://thumbs.dreamstime.com/b/toy-teddy-bear-isolated-white-background-40677685.jpg"> -->
</div>
<div class="col-lg-5 col-md-6"> <div class="col-lg-5 col-md-6">
product info div product info div
<div class="product-info" style="border: 2px dotted black;">
<h2>{{ item_name }} </h2>
<h4>Product Specifications</h4>
<p>{{ item_specs }}</p>
</div>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Place Bid</button>
<h1>Latest Bids</h1>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Enter Bid</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="auction/<int:pk>/" method="post">
<div class="form-group">
{% csrf_token %}
<label for="recipient-name" class="col-form-label">Enter Bid amount:</label>
<form id="form" method="post">
<input type="number" class="form-control" id="amount">
</form>
<!--add an if else statement here re. floor price-->
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary">Confirm Bid</button>
</div>
</div>
</div>
</div>
<h1>This is the Bid: {{ item_bid }}</h1> <div class="product-info" style="border: 2px dotted black;">
<!-- latest bids / history --> <h2>{{ item_name }} </h2>
<ul class="cards">
<li><img src="" alt="">
<p>Alice offered 500!</p>
<p>2 seconds ago</p>
</li> <h4>Product Specifications</h4>
<p>{{ item_specs }}</p>
</div>
<li><img src="" alt=""> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"
<p>Bob offered 400!</p> data-whatever="@mdo">Place Bid</button>
<p>5 seconds ago</p> <h1>Latest Bids</h1>
</li>
<li><img src="" alt=""> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
<p>Charles offered 300!</p> aria-hidden="true">
<p>30 seconds ago</p> <div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Enter Bid</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</li> <div class="modal-body">
<form action="auction/<int:pk>/" method="post">
<li><img src="" alt=""> <div class="form-group">
<p>Charles offered 300!</p> {% csrf_token %}
<p>3 minutes ago</p> <label for="recipient-name" class="col-form-label">Enter Bid amount:</label>
<form id="form" method="post">
<input type="number" class="form-control" id="amount">
</form>
<!--add an if else statement here re. floor price-->
</div>
</form>
</li> </div>
<li><img src="" alt=""> <div class="modal-footer">
<p>Charles offered 300!</p> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<p>5 mintues ago</p> <button type="button" class="btn btn-primary">Confirm Bid</button>
</div>
</li> </div>
</div> </div>
</div>
<!-- latest bids / history -->
<ul class="cards">
{% if auction_bids %}
{% for bid in auction_bids %}
<li><img src="" alt="">
<p>Alice offered {{ bid.amount }}</p>
<p>{{bid.bidtime | timesince}} ago </p>
</li>
{% endfor %}
{% else %}
<h3> no bids placed yet.</h3>
{% endif %}
</ul>
</div> </div>
</div>
</div>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
...@@ -31,14 +31,19 @@ def homepage(request): ...@@ -31,14 +31,19 @@ def homepage(request):
def auction(request, pk): def auction(request, pk):
# Current auction ID # Current auction ID
auction = Auction.objects.get(pk=pk) auction = Auction.objects.get(pk=pk)
auction_bid = AuctionBid.objects.filter(auctionid=pk) auction_bids = AuctionBid.objects.filter(auctionid=pk)
auction_item = auction.itemid auction_item = auction.itemid
print(auction_bids)
print(type(auction_bids))
for bid in auction_bids:
print(bid.amount)
context = { context = {
'item_name':auction_item.itemname, 'item_name':auction_item.itemname,
'item_specs': auction_item.itemspecs, 'item_specs': auction_item.itemspecs,
'item_bid' : auction_bid.amount, 'auction_bids' : auction_bids,
'item_floor_price': auction_item.floorprice 'item_floor_price': auction_item.floorprice
# need to make floor price object here # need to make floor price object here
} }
......
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