added googlebooks_id method on work, cleaned access
parent
a20e01c5b2
commit
98a7c3f73b
|
@ -33,7 +33,7 @@
|
||||||
<!--- editions --->
|
<!--- editions --->
|
||||||
|
|
||||||
{% if work %}
|
{% if work %}
|
||||||
{% with work.editions.all.0.googlebooks_id as googlebooks_id %}
|
{% with work.googlebooks_id as googlebooks_id %}
|
||||||
{% include "book_panel.html" %}
|
{% include "book_panel.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -250,7 +250,10 @@ class Work(models.Model):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def googlebooks_url(self):
|
def googlebooks_url(self):
|
||||||
return "http://books.google.com/books?id=%s" % self.googlebooks_id
|
if self.googlebooks_id:
|
||||||
|
return "http://books.google.com/books?id=%s" % self.googlebooks_id
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def goodreads_id(self):
|
def goodreads_id(self):
|
||||||
|
@ -323,7 +326,7 @@ class Work(models.Model):
|
||||||
if self.first_ebook() or self.first_epub():
|
if self.first_ebook() or self.first_epub():
|
||||||
status = "Available"
|
status = "Available"
|
||||||
else:
|
else:
|
||||||
status = "No campaign yet"
|
status = "No campaign yet"
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def percent_unglued(self):
|
def percent_unglued(self):
|
||||||
|
@ -408,10 +411,10 @@ class Work(models.Model):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def publication_date(self):
|
def publication_date(self):
|
||||||
for edition in Edition.objects.filter(work=self):
|
for edition in Edition.objects.filter(work=self):
|
||||||
if edition.publication_date:
|
if edition.publication_date:
|
||||||
return edition.publication_date
|
return edition.publication_date
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
@ -451,12 +454,18 @@ class Edition(models.Model):
|
||||||
return "%s (%s)" % (self.title, self.isbn_13)
|
return "%s (%s)" % (self.title, self.isbn_13)
|
||||||
|
|
||||||
def cover_image_small(self):
|
def cover_image_small(self):
|
||||||
server_id = random.randint(0, 9)
|
if self.googlebooks_id:
|
||||||
return "http://bks%i.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % (server_id, self.googlebooks_id)
|
server_id = random.randint(0, 9)
|
||||||
|
return "http://bks%i.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=5" % (server_id, self.googlebooks_id)
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
def cover_image_thumbnail(self):
|
def cover_image_thumbnail(self):
|
||||||
server_id = random.randint(0, 9)
|
if self.googlebooks_id:
|
||||||
return "http://bks%s.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=1" % (server_id, self.googlebooks_id)
|
server_id = random.randint(0, 9)
|
||||||
|
return "http://bks%s.books.google.com/books?id=%s&printsec=frontcover&img=1&zoom=1" % (server_id, self.googlebooks_id)
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def isbn_10(self):
|
def isbn_10(self):
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
<div class="{% cycle 'row1' 'row2' %}">
|
<div class="{% cycle 'row1' 'row2' %}">
|
||||||
{% with campaign.status as status %}
|
{% with campaign.status as status %}
|
||||||
{% with campaign.deadline as deadline %}
|
{% with campaign.deadline as deadline %}
|
||||||
{% with campaign.work.editions.all.0.googlebooks_id as googlebooks_id %}
|
{% with campaign.work.googlebooks_id as googlebooks_id %}
|
||||||
{% with campaign.work as work %}
|
{% with campaign.work as work %}
|
||||||
{% include "book_panel.html" %}
|
{% include "book_panel.html" %}
|
||||||
{% endwith %}{% endwith %}{% endwith %}{% endwith %}
|
{% endwith %}{% endwith %}{% endwith %}{% endwith %}
|
||||||
|
|
|
@ -253,7 +253,7 @@ how do I integrate the your wishlist thing with the tabs thing?
|
||||||
<div class="{% cycle 'row1' 'row2' %}">
|
<div class="{% cycle 'row1' 'row2' %}">
|
||||||
{% with work.last_campaign_status as status %}
|
{% with work.last_campaign_status as status %}
|
||||||
{% with work.last_campaign.deadline as deadline %}
|
{% with work.last_campaign.deadline as deadline %}
|
||||||
{% with work.editions.all.0.googlebooks_id as googlebooks_id %}
|
{% with work.googlebooks_id as googlebooks_id %}
|
||||||
{% include "book_panel.html" %}
|
{% include "book_panel.html" %}
|
||||||
{% endwith %}{% endwith %}{% endwith %}
|
{% endwith %}{% endwith %}{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<div class="{% cycle 'row1' 'row2' %}">
|
<div class="{% cycle 'row1' 'row2' %}">
|
||||||
{% with work.last_campaign_status as status %}
|
{% with work.last_campaign_status as status %}
|
||||||
{% with work.last_campaign.deadline as deadline %}
|
{% with work.last_campaign.deadline as deadline %}
|
||||||
{% with work.editions.all.0.googlebooks_id as googlebooks_id %}
|
{% with work.googlebooks_id as googlebooks_id %}
|
||||||
{% include "book_panel.html" %}
|
{% include "book_panel.html" %}
|
||||||
{% endwith %}{% endwith %}{% endwith %}
|
{% endwith %}{% endwith %}{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
<div class="{% cycle 'row1' 'row2' %}">
|
<div class="{% cycle 'row1' 'row2' %}">
|
||||||
{% with work.last_campaign_status as status %}
|
{% with work.last_campaign_status as status %}
|
||||||
{% with work.last_campaign.deadline as deadline %}
|
{% with work.last_campaign.deadline as deadline %}
|
||||||
{% with work.editions.all.0.googlebooks_id as googlebooks_id %}
|
{% with work.googlebooks_id as googlebooks_id %}
|
||||||
{% include "book_panel.html" %}
|
{% include "book_panel.html" %}
|
||||||
{% endwith %}{% endwith %}{% endwith %}
|
{% endwith %}{% endwith %}{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue