detab source file
parent
9d6066c929
commit
1cad25da28
|
@ -682,9 +682,9 @@ def wishlist(request):
|
||||||
# TODO: where to redirect?
|
# TODO: where to redirect?
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/')
|
||||||
elif add_work_id:
|
elif add_work_id:
|
||||||
# if adding from work page, we have may work.id, not googlebooks_id
|
# if adding from work page, we have may work.id, not googlebooks_id
|
||||||
work = models.Work.objects.get(pk=add_work_id)
|
work = models.Work.objects.get(pk=add_work_id)
|
||||||
request.user.wishlist.add_work(work,'user')
|
request.user.wishlist.add_work(work,'user')
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/')
|
||||||
|
|
||||||
class CampaignFormView(FormView):
|
class CampaignFormView(FormView):
|
||||||
|
@ -906,7 +906,7 @@ def librarything_load(request):
|
||||||
ct.user = user
|
ct.user = user
|
||||||
ct.description = "Loading LibraryThing collection of %s to user %s." % (lt_username, user)
|
ct.description = "Loading LibraryThing collection of %s to user %s." % (lt_username, user)
|
||||||
ct.save()
|
ct.save()
|
||||||
|
|
||||||
return HttpResponse("<span style='margin: auto 10px auto 36px;vertical-align: middle;display: inline-block;'>We're on it! <a href='JavaScript:window.location.reload()'>Reload the page</a> to see the books we've snagged so far.</span>")
|
return HttpResponse("<span style='margin: auto 10px auto 36px;vertical-align: middle;display: inline-block;'>We're on it! <a href='JavaScript:window.location.reload()'>Reload the page</a> to see the books we've snagged so far.</span>")
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
return HttpResponse("Error in loading LibraryThing library: %s " % (e))
|
return HttpResponse("Error in loading LibraryThing library: %s " % (e))
|
||||||
|
@ -1020,29 +1020,29 @@ def work_goodreads(request, work_id):
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
def emailshare(request):
|
def emailshare(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form=EmailShareForm(request.POST)
|
form=EmailShareForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
subject = form.cleaned_data['subject']
|
subject = form.cleaned_data['subject']
|
||||||
message = form.cleaned_data['message']
|
message = form.cleaned_data['message']
|
||||||
sender = form.cleaned_data['sender']
|
sender = form.cleaned_data['sender']
|
||||||
recipient = form.cleaned_data['recipient']
|
recipient = form.cleaned_data['recipient']
|
||||||
send_mail(subject, message, sender, [recipient])
|
send_mail(subject, message, sender, [recipient])
|
||||||
try:
|
try:
|
||||||
next = form.cleaned_data['next']
|
next = form.cleaned_data['next']
|
||||||
except:
|
except:
|
||||||
next = ''
|
next = ''
|
||||||
return HttpResponseRedirect(next)
|
return HttpResponseRedirect(next)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
next = request.GET['next']
|
next = request.GET['next']
|
||||||
except:
|
except:
|
||||||
next = ''
|
next = ''
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
sender = request.user.email
|
sender = request.user.email
|
||||||
else:
|
else:
|
||||||
sender = ''
|
sender = ''
|
||||||
form = EmailShareForm(initial={'next':next, 'message':"I'm ungluing books at unglue.it. Here's one of my favorites: "+next, "sender":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})
|
||||||
|
|
Loading…
Reference in New Issue