links to edition-specific google books in detail view

pull/1/head
Andromeda Yelton 2011-12-09 16:15:11 -05:00
parent dd5c90d4f0
commit 66ebeaf07e
2 changed files with 5 additions and 1 deletions

View File

@ -166,7 +166,7 @@ jQuery(document).ready(function(){
<h4>Editions</h4> <h4>Editions</h4>
{% for edition in editions %} {% for edition in editions %}
<div class="editions"><div><img src="http://covers.openlibrary.org/b/isbn/{{edition.isbn_10}}-S.jpg" /></div><div class="metadata">{{edition.publisher}}<br />{{edition.publication_date}}</div></div> <div class="editions"><div><img src="http://bks{{ server }}.books.google.com/books?id={{ edition.googlebooks_id }}&printsec=frontcover&img=1&zoom=5" /></div><div class="metadata">{{edition.publisher}}<br />{{edition.publication_date}}<br /><a href="http://bks{{ server }}.books.google.com/books?id={{ edition.googlebooks_id }}">This edition on Google Books</a></div></div>
{% endfor %} {% endfor %}
{% if work.claim.count %} {% if work.claim.count %}

View File

@ -6,6 +6,7 @@ import logging
import datetime import datetime
from decimal import Decimal as D from decimal import Decimal as D
from re import sub from re import sub
from random import randint
from django import forms from django import forms
from django.db.models import Q, Count, Sum from django.db.models import Q, Count, Sum
@ -77,6 +78,8 @@ def work(request, work_id, action='display'):
work = get_object_or_404(models.Work, id=work_id) work = get_object_or_404(models.Work, id=work_id)
editions = work.editions.all() editions = work.editions.all()
campaign = work.last_campaign() campaign = work.last_campaign()
server = randint(0,9)
if not request.user.is_anonymous(): if not request.user.is_anonymous():
claimform = UserClaimForm( request.user, data={'work':work_id, 'user': request.user.id}) claimform = UserClaimForm( request.user, data={'work':work_id, 'user': request.user.id})
else: else:
@ -102,6 +105,7 @@ def work(request, work_id, action='display'):
'wishers': wishers, 'wishers': wishers,
'base_url': base_url, 'base_url': base_url,
'editions': editions, 'editions': editions,
'server': server,
}) })
def manage_campaign(request, id): def manage_campaign(request, id):