Merge branch 'ry'
commit
9eb40c36ec
|
@ -10,7 +10,10 @@ class Command(BaseCommand):
|
|||
print "Last 20 Works without identifiers: "
|
||||
for w in models.Work.objects.filter(identifiers__isnull=True).order_by('-created')[0:20]:
|
||||
print "id: %d | title: %s | created: %s" % (w.id, w.title, w.created)
|
||||
|
||||
|
||||
# models.Work.objects.filter(identifiers__isnull=True).filter(editions__isnull=False)[0].identifiers.all()
|
||||
print "Number of editions that are currently tied to Works w/o identifiers ", \
|
||||
models.Edition.objects.filter(work__identifiers__isnull=True).count()
|
||||
print "Number of Identifiers not tied to Works (should be 0): ", \
|
||||
models.Identifier.objects.filter(work__isnull=True).count()
|
||||
print "Number of Editions not tied to a Work (should be 0): ", models.Edition.objects.filter(work__isnull=True).count()
|
||||
|
|
|
@ -839,6 +839,8 @@ def wishlist(request):
|
|||
googlebooks_id = request.POST.get('googlebooks_id', None)
|
||||
remove_work_id = request.POST.get('remove_work_id', None)
|
||||
add_work_id = request.POST.get('add_work_id', None)
|
||||
logger.info("about to print again...")
|
||||
logger.info("googlebooks_id %s, remove_work_id %s, add_work_id %s " %( googlebooks_id, remove_work_id, add_work_id))
|
||||
if googlebooks_id:
|
||||
try:
|
||||
edition = bookloader.add_by_googlebooks_id(googlebooks_id)
|
||||
|
@ -848,8 +850,12 @@ def wishlist(request):
|
|||
request.user.wishlist.add_work(edition.work,'user')
|
||||
except bookloader.LookupFailure:
|
||||
logger.warning("failed to load googlebooks_id %s" % googlebooks_id)
|
||||
except Exception, e:
|
||||
logger.warning("Error in wishlist adding %s" % (e))
|
||||
# TODO: redirect to work page, when it exists
|
||||
return HttpResponseRedirect('/')
|
||||
|
||||
return HttpResponseRedirect('/')
|
||||
elif remove_work_id:
|
||||
work = models.Work.objects.get(id=int(remove_work_id))
|
||||
request.user.wishlist.remove_work(work)
|
||||
|
|
Loading…
Reference in New Issue