don't link cover to google books if own cover

pull/1/head
eric 2014-10-29 15:18:32 -04:00
parent c7071e2f44
commit c5bb7220f2
2 changed files with 8 additions and 2 deletions

View File

@ -1120,7 +1120,13 @@ class Work(models.Model):
@property
def openlibrary_url(self):
return "http://openlibrary.org" + self.openlibrary_id
def uses_google_cover(self):
if self.preferred_edition and self.preferred_edition.cover_image:
return False
else:
return self.googlebooks_id
def cover_image_small(self):
if self.preferred_edition and self.preferred_edition.cover_image_small():
return self.preferred_edition.cover_image_small()

View File

@ -71,7 +71,7 @@
<div class="js-maincol-inner">
<div id="content-block">
<div class="book-detail">
{% if work.googlebooks_id %}
{% if work.uses_google_cover %}
<div id="book-detail-img">
<a href="{{ work.googlebooks_url }}">
<img src="{{ work.cover_image_thumbnail }}" alt="Find {{ work.title }} at Google Books" title="Find {{ work.title }} at Google Books" width="131" height="192" /></a>