Created a __str__ to turn objects into strings in models.py.

Searched for the latest price/most recent price in views.py.
Removed excess input field in auction.html.
parent 38180071
...@@ -78,7 +78,6 @@ a{% extends 'boodlesite\templates\base.html' %} ...@@ -78,7 +78,6 @@ a{% extends 'boodlesite\templates\base.html' %}
<label for="recipient-name" class="col-form-label">Enter Bid amount:</label> <label for="recipient-name" class="col-form-label">Enter Bid amount:</label>
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form }}
<input type="number" class="form-control" id="amount">
{% if form.amount.errors %} {% if form.amount.errors %}
<ol> <ol>
{% for error in form.amount.errors %} {% for error in form.amount.errors %}
...@@ -108,6 +107,7 @@ a{% extends 'boodlesite\templates\base.html' %} ...@@ -108,6 +107,7 @@ a{% extends 'boodlesite\templates\base.html' %}
{% for bid in auction_bids %} {% for bid in auction_bids %}
<li><img src="" alt=""> <li><img src="" alt="">
<p>User offered {{ bid.amount }}</p> <p>User offered {{ bid.amount }}</p>
<p> &nbsp | &nbsp </p>
<p>{{bid.bidtime | timesince}} ago </p> <p>{{bid.bidtime | timesince}} ago </p>
</li> </li>
......
...@@ -31,6 +31,9 @@ class AuctionBid(models.Model): ...@@ -31,6 +31,9 @@ class AuctionBid(models.Model):
managed = False managed = False
db_table = 'auctionbid' db_table = 'auctionbid'
def __str__(self):
return '%d' % (self.amount)
class AuthGroup(models.Model): class AuthGroup(models.Model):
name = models.CharField(unique=True, max_length=150) name = models.CharField(unique=True, max_length=150)
......
...@@ -45,6 +45,9 @@ def auction(request, pk): ...@@ -45,6 +45,9 @@ def auction(request, pk):
else: else:
highest_bid = auction_bids[0] highest_bid = auction_bids[0]
print("This is the auction bids: ", auction_bids)
prev_amt = AuctionBid.objects.latest('amount');
print(prev_amt)
form = PlaceBidForm() form = PlaceBidForm()
if request.method == 'POST': if request.method == 'POST':
......
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