Merge branch 'master' of github.com:Gluejar/regluit

pull/1/head
Andromeda Yelton 2012-01-09 16:13:49 -05:00
commit 95f32400ec
4 changed files with 68 additions and 2 deletions

View File

@ -0,0 +1,16 @@
{% extends "basedocumentation.html" %}
{% block title %}Pledge Cancelled{% endblock %}
{% block extra_extra_head %}
<link type="text/css" rel="stylesheet" href="/static/css/campaign.css" />
{% endblock %}
{% block doccontent %}
<div class="thank-you">Would you consider pledging in the future?</div>
<div>{{output}}</div>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "basedocumentation.html" %}
{% block title %}Pledge Completed{% endblock %}
{% block extra_extra_head %}
<link type="text/css" rel="stylesheet" href="/static/css/campaign.css" />
{% endblock %}
{% block doccontent %}
<div class="thank-you">Thank you!</div>
<div>{{output}}</div>
{% endblock %}

View File

@ -5,7 +5,7 @@ from django.views.generic import ListView, DetailView
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from regluit.core.models import Campaign from regluit.core.models import Campaign
from regluit.frontend.views import CampaignFormView, GoodreadsDisplayView, LibraryThingView, PledgeView, FAQView from regluit.frontend.views import CampaignFormView, GoodreadsDisplayView, LibraryThingView, PledgeView, PledgeCompleteView, PledgeCancelView, FAQView
from regluit.frontend.views import CampaignListView, DonateView, WorkListView from regluit.frontend.views import CampaignListView, DonateView, WorkListView
urlpatterns = patterns( urlpatterns = patterns(
@ -48,6 +48,8 @@ urlpatterns = patterns(
#may want to deprecate the following #may want to deprecate the following
url(r"^setup/work/(?P<work_id>\d+)/$", "work", {'action':'setup_campaign'}, name="setup_campaign"), url(r"^setup/work/(?P<work_id>\d+)/$", "work", {'action':'setup_campaign'}, name="setup_campaign"),
url(r"^pledge/(?P<work_id>\d+)/$", login_required(PledgeView.as_view()), name="pledge"), url(r"^pledge/(?P<work_id>\d+)/$", login_required(PledgeView.as_view()), name="pledge"),
url(r"^pledge/cancel/$", PledgeCancelView.as_view(), name="pledge_cancel"),
url(r"^pledge/complete/$", PledgeCompleteView.as_view(), name="pledge_complete"),
url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"), url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"),
url(r"^subjects/$", "subjects", name="subjects"), url(r"^subjects/$", "subjects", name="subjects"),
url(r"^librarything/$", LibraryThingView.as_view(), name="librarything"), url(r"^librarything/$", LibraryThingView.as_view(), name="librarything"),

View File

@ -300,6 +300,37 @@ class PledgeView(FormView):
response = t.reference response = t.reference
logger.info("PledgeView paypal: Error " + str(t.reference)) logger.info("PledgeView paypal: Error " + str(t.reference))
return HttpResponse(response) return HttpResponse(response)
class PledgeCompleteView(TemplateView):
"""A callback for PayPal to tell unglue.it that a payment transaction has completed successfully"""
template_name="pledge_complete.html"
def get_context_data(self, **kwargs):
# pick up all get and post parameters and display
context = super(PledgeCompleteView, self).get_context_data(**kwargs)
output = "pledge complete"
output += self.request.method + "\n" + str(self.request.REQUEST.items())
context["output"] = output
return context
class PledgeCancelView(TemplateView):
"""A callback for PayPal to tell unglue.it that a payment transaction has been canceled by the user"""
template_name="pledge_cancel.html"
def get_context_data(self, **kwargs):
# pick up all get and post parameters and display
context = super(PledgeCancelView, self).get_context_data(**kwargs)
output = "pledge cancel"
output += self.request.method + "\n" + str(self.request.REQUEST.items())
context["output"] = output
return context
class DonateView(FormView): class DonateView(FormView):
template_name="donate.html" template_name="donate.html"
@ -1085,4 +1116,4 @@ def feedback(request):
form = FeedbackForm(initial={"sender":sender, "subject": "Feedback on page "+page, "page":page, "num1":num1, "num2":num2, "answer":sum}) form = FeedbackForm(initial={"sender":sender, "subject": "Feedback on page "+page, "page":page, "num1":num1, "num2":num2, "answer":sum})
return render(request, "feedback.html", {'form':form, 'num1':num1, 'num2':num2}) return render(request, "feedback.html", {'form':form, 'num1':num1, 'num2':num2})