diff --git a/frontend/views.py b/frontend/views.py index 9076844e..2919d4e5 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -682,9 +682,9 @@ def wishlist(request): # TODO: where to redirect? return HttpResponseRedirect('/') elif add_work_id: - # if adding from work page, we have may work.id, not googlebooks_id - work = models.Work.objects.get(pk=add_work_id) - request.user.wishlist.add_work(work,'user') + # if adding from work page, we have may work.id, not googlebooks_id + work = models.Work.objects.get(pk=add_work_id) + request.user.wishlist.add_work(work,'user') return HttpResponseRedirect('/') class CampaignFormView(FormView): @@ -906,7 +906,7 @@ def librarything_load(request): ct.user = user ct.description = "Loading LibraryThing collection of %s to user %s." % (lt_username, user) ct.save() - + return HttpResponse("We're on it! Reload the page to see the books we've snagged so far.") except Exception,e: return HttpResponse("Error in loading LibraryThing library: %s " % (e)) @@ -1020,29 +1020,29 @@ def work_goodreads(request, work_id): return HttpResponseRedirect(url) def emailshare(request): - if request.method == 'POST': - form=EmailShareForm(request.POST) - if form.is_valid(): - subject = form.cleaned_data['subject'] - message = form.cleaned_data['message'] - sender = form.cleaned_data['sender'] - recipient = form.cleaned_data['recipient'] - send_mail(subject, message, sender, [recipient]) - try: - next = form.cleaned_data['next'] - except: - next = '' - return HttpResponseRedirect(next) - - else: - try: - next = request.GET['next'] - except: - next = '' - if request.user.is_authenticated(): - sender = request.user.email - else: - sender = '' - form = EmailShareForm(initial={'next':next, 'message':"I'm ungluing books at unglue.it. Here's one of my favorites: "+next, "sender":sender}) + if request.method == 'POST': + form=EmailShareForm(request.POST) + if form.is_valid(): + subject = form.cleaned_data['subject'] + message = form.cleaned_data['message'] + sender = form.cleaned_data['sender'] + recipient = form.cleaned_data['recipient'] + send_mail(subject, message, sender, [recipient]) + try: + next = form.cleaned_data['next'] + except: + next = '' + return HttpResponseRedirect(next) + + else: + try: + next = request.GET['next'] + except: + next = '' + if request.user.is_authenticated(): + sender = request.user.email + else: + sender = '' + form = EmailShareForm(initial={'next':next, 'message':"I'm ungluing books at unglue.it. Here's one of my favorites: "+next, "sender":sender}) - return render(request, "emailshare.html", {'form':form}) + return render(request, "emailshare.html", {'form':form})