Commit e84aa90e authored by Daniel W Bond's avatar Daniel W Bond
Browse files

lookouts reflect new booleans

parent 27980cb2
......@@ -16,7 +16,8 @@ class Lookout(TimeStampedModel):
#course = models.ForeignKey(Course)
slug = RandomSlugField(length = 6)
def get_listings(self):
isbn_listings = models.Q( isbn = self.isbn, active = True )
# may be reason to resurrect active as an actual field, possibly can call function?
isbn_listings = models.Q( isbn = self.isbn, sold = False, cancelled = False )
return Listing.objects.filter( isbn_listings )
# needs get_absolute_url
......
......@@ -28,9 +28,11 @@ SRCT Bookshare • Homepage
<legend><i class="fa fa-book"></i> <a href="{{ lookout.get_absolute_url }}">{{ lookout.isbn|isbn_name }}</a></legend>
<div class="row">
{% for listing in lookout.get_listings %}
{% if not listing.cancelled or listing.sold %}
<div class="col-md-6">
{% include 'listing_preview_panel.html' %}
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
......
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