Commit c5c20cc9 authored by Daniel W Bond's avatar Daniel W Bond

added number of bids to profile listings

parent 881fa9cb
......@@ -57,8 +57,9 @@ SRCT Bookshare • {{ student.user.first_name }} {{ student.user.last_name }}
<table class="table table-bordered table-hover table-condensed text-center">
<thead>
<td class="col-md-2"><h4><strong>ISBN</strong></h4></td>
<td class="col-md-8"><h4><strong>Title</strong></h4></td>
<td class="col-md-7"><h4><strong>Title</strong></h4></td>
<td class="col-md-1"><h4><strong>Price</strong></h4></td>
<td class="col-md-1"><h4><strong>Bids</strong></h4></td>
<td class="col-md-1"><h4><strong>Status</strong></h4></td>
</thead>
{% for listing in listings %}
......@@ -77,6 +78,7 @@ SRCT Bookshare &bull; {{ student.user.first_name }} {{ student.user.last_name }}
${{ listing.price }}
{% endif %}
</h5></td>
<td class="text-center"><h5>{{ listing.bids|length }}</h5></td>
<td class="text-center"><h5>
{% if listing.sold %}
<span class="label label-primary"><strong>Sold</strong></span>
......@@ -129,10 +131,12 @@ SRCT Bookshare &bull; {{ student.user.first_name }} {{ student.user.last_name }}
<div class="table-responsive">
<table class="table table-bordered table-hover table-condensed text-center">
<thead>
<td class="col-md-6"><h4><strong>Title</strong></h4></td>
<td class="col-md-2"><h4><strong>Course</strong></h4></td>
<td class="col-md-2"><h4><strong>Price</strong></h4></td>
<td class="col-md-2"><h4><strong>Listing Status</strong></h4></td>
<!-- the br's is a really shitty way of doing this -->
<td class="col-md-1"><h4><strong>Date<br />Bid</strong></h4></td>
<td class="col-md-8"><h4><strong><br />Title</strong></h4></td>
<td class="col-md-1"><h4><strong>Listing Status</strong></h4></td>
<td class="col-md-1"><h4><strong><br />Course</strong></h4></td>
<td class="col-md-1"><h4><strong><br />Price</strong></h4></td>
</thead>
<tbody>
{% for bid in bids %}
......@@ -141,15 +145,8 @@ SRCT Bookshare &bull; {{ student.user.first_name }} {{ student.user.last_name }}
{% else %}
<tr>
{% endif %}
<td class="text-center"><h5>{{ bid.created|date:"m/d/y" }}</h5></td>
<td class="text-center"><h5><a href="{{ bid.listing.get_absolute_url }}">{{ bid.listing.isbn|isbn_name|title }}<a/></h5></td>
<td class="text-center"><h5>{{ bid.listing.course_abbr }}</h5></td>
<td class="text-center"><h5>
${{ bid.price }}
{% if bid == bid.listing.winning_bid %}
<small><span class="label label-success"><strong>Winning Bid</strong></span></small>
{% else %}
{% endif %}
</h5></td>
<td class="text-center"><h5>
{% if bid.listing.sold %}
<span class="label label-primary"><strong>Sold</strong></span>
......@@ -161,6 +158,14 @@ SRCT Bookshare &bull; {{ student.user.first_name }} {{ student.user.last_name }}
<span class="label label-info"><strong>Active</strong></span>
{% endif %}
</h5></td>
<td class="text-center"><h5>{{ bid.listing.course_abbr }}</h5></td>
<td class="text-center"><h5>
${{ bid.price }}
{% if bid == bid.listing.winning_bid %}
<br /><small><span class="label label-success"><strong>Winning Bid</strong></span></small>
{% else %}
{% endif %}
</h5></td>
{% endfor %}
</tbody>
</table>
......
......@@ -98,6 +98,9 @@ class Listing(TimeStampedModel):
else:
return True
def bids(self):
return Bid.objects.filter(listing=self)
def final_price(self):
try:
price = self.winning_bid.price
......
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