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' %}
<div class="container">
<div class="row">
<div class="col-lg-7 col-md-6">
product display div
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<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">
</div>
<div class="carousel-item">
<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 class="carousel-item">
<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">
</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 class="row">
<div class="col-lg-7 col-md-6">
product display div
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<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">
</div>
<div class="carousel-item">
<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 class="carousel-item">
<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">
</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">
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>
<div class="col-lg-5 col-md-6">
product info div
<h1>This is the Bid: {{ item_bid }}</h1>
<div class="product-info" style="border: 2px dotted black;">
<!-- latest bids / history -->
<ul class="cards">
<li><img src="" alt="">
<p>Alice offered 500!</p>
<p>2 seconds ago</p>
<h2>{{ item_name }} </h2>
</li>
<h4>Product Specifications</h4>
<p>{{ item_specs }}</p>
</div>
<li><img src="" alt="">
<p>Bob offered 400!</p>
<p>5 seconds ago</p>
</li>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"
data-whatever="@mdo">Place Bid</button>
<h1>Latest Bids</h1>
<li><img src="" alt="">
<p>Charles offered 300!</p>
<p>30 seconds ago</p>
<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>
</li>
<div class="modal-body">
<form action="auction/<int:pk>/" method="post">
<li><img src="" alt="">
<p>Charles offered 300!</p>
<p>3 minutes ago</p>
<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>
</li>
</div>
<li><img src="" alt="">
<p>Charles offered 300!</p>
<p>5 mintues ago</p>
<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>
</li>
</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>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
......@@ -31,14 +31,19 @@ def homepage(request):
def auction(request, pk):
# Current auction ID
auction = Auction.objects.get(pk=pk)
auction_bid = AuctionBid.objects.filter(auctionid=pk)
auction_bids = AuctionBid.objects.filter(auctionid=pk)
auction_item = auction.itemid
print(auction_bids)
print(type(auction_bids))
for bid in auction_bids:
print(bid.amount)
context = {
'item_name':auction_item.itemname,
'item_specs': auction_item.itemspecs,
'item_bid' : auction_bid.amount,
'auction_bids' : auction_bids,
'item_floor_price': auction_item.floorprice
# 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