Merge branch 'master' of github.com:Gluejar/regluit into goodreads
commit
e09cf8186d
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
<div class="listview book-name">
|
||||
<div class="title">
|
||||
<a href="/workstub/{{ result.urltitle }}/{{ result.urlimage }}/{{ result.urlauthor }}/{{ result.googlebooks_id }}">{{ result.title }}</a>
|
||||
<a href="{% url googlebooks result.googlebooks_id %}">{{ result.title }}</a>
|
||||
</div>
|
||||
<div class="listview author {{ result.author }}">{{ result.author }}</div>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import re
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test.client import Client
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -36,3 +38,15 @@ class SupporterPage(TestCase):
|
|||
anon_client = Client()
|
||||
r = self.client.get("/supporter/test/")
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
class GoogleBooksTest(TestCase):
|
||||
|
||||
def test_googlebooks_id(self):
|
||||
r = self.client.get("/googlebooks/wtPxGztYx-UC/")
|
||||
self.assertEqual(r.status_code, 302)
|
||||
work_url = r['location']
|
||||
self.assertTrue(re.match('.*/work/\d+/$', work_url))
|
||||
|
||||
r = self.client.get("/googlebooks/wtPxGztYx-UC/")
|
||||
self.assertEqual(r.status_code, 302)
|
||||
self.assertEqual(r['location'], work_url)
|
||||
|
|
|
@ -33,7 +33,7 @@ urlpatterns = patterns(
|
|||
url(r"^goodreads/clear_wishlist/$","clear_wishlist", name="clear_wishlist"),
|
||||
url(r"^stub/", "stub", name="stub"),
|
||||
url(r"^work/(?P<work_id>\d+)/$", "work", name="work"),
|
||||
url(r"^workstub/(?P<title>.+)/(?P<imagebase>.+)/(?P<image>.+)/(?P<author>.+)/(?P<googlebooks_id>.+)/$", "workstub", name="workstub"),
|
||||
url(r"^googlebooks/(?P<googlebooks_id>.+)/$", "googlebooks", name="googlebooks"),
|
||||
#may want to deprecate the following
|
||||
url(r"^setup/work/(?P<work_id>\d+)/$", "work", {'action':'setup_campaign'}, name="setup_campaign"),
|
||||
url(r"^pledge/(?P<work_id>\d+)/$", "pledge", name="pledge"),
|
||||
|
|
|
@ -83,13 +83,16 @@ def manage_campaign(request, id):
|
|||
form= ManageCampaignForm(instance=campaign)
|
||||
return render(request, 'manage_campaign.html', {'campaign': campaign, 'form':form})
|
||||
|
||||
def workstub(request, title, imagebase, image, author, googlebooks_id, action='display'):
|
||||
premiums = None
|
||||
title = urllib.unquote_plus(title)
|
||||
imagebase = urllib.unquote_plus(imagebase)
|
||||
image = urllib.unquote_plus(image)
|
||||
author = urllib.unquote_plus(author)
|
||||
return render(request, 'workstub.html', {'title': title, 'image': image, 'imagebase': imagebase, 'author': author, 'googlebooks_id': googlebooks_id, 'premiums': premiums, 'ungluers': userlists.other_users(supporter, 5)})
|
||||
def googlebooks(request, googlebooks_id):
|
||||
try:
|
||||
edition = models.Edition.objects.get(googlebooks_id=googlebooks_id)
|
||||
except models.Edition.DoesNotExist:
|
||||
edition = bookloader.add_by_googlebooks_id(googlebooks_id)
|
||||
if not edition:
|
||||
return HttpResponseNotFound("invalid googlebooks id")
|
||||
tasks.add_related.delay(edition.isbn_10)
|
||||
work_url = reverse('work', kwargs={'work_id': edition.work.id})
|
||||
return HttpResponseRedirect(work_url)
|
||||
|
||||
def subjects(request):
|
||||
order = request.GET.get('order')
|
||||
|
|
|
@ -101,3 +101,5 @@ CELERYD_HIJACK_ROOT_LOGGER = False
|
|||
|
||||
# a debug_toolbar setting
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
|
||||
CELERYD_LOG_LEVEL = "INFO"
|
||||
|
|
|
@ -78,6 +78,12 @@ div.book-list.listview div.booklist-status {
|
|||
margin-right: 7px;
|
||||
float: left;
|
||||
}
|
||||
div.add-wishlist {
|
||||
cursor: pointer;
|
||||
}
|
||||
div.remove-wishlist {
|
||||
cursor: pointer;
|
||||
}
|
||||
.booklist-status.listview span.booklist-status-label {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,14 @@ div.book-list.listview{
|
|||
}
|
||||
}
|
||||
|
||||
div.add-wishlist {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.remove-wishlist {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.booklist-status.listview {
|
||||
span.booklist-status-label {
|
||||
display: none;
|
||||
|
|
Loading…
Reference in New Issue