removed legacy DonateView
parent
eb185438b4
commit
c2636f5bba
|
@ -1,21 +0,0 @@
|
||||||
{% extends "basedocumentation.html" %}
|
|
||||||
|
|
||||||
{% block title %}Donate{% endblock %}
|
|
||||||
|
|
||||||
{% block extra_extra_head %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block doccontent %}
|
|
||||||
|
|
||||||
<h2>Donate</h2>
|
|
||||||
<p>Wonderful: We're glad that you would like to donate to our <b>partnering non-profit</b>.</p>
|
|
||||||
|
|
||||||
<form method="post" action="#">
|
|
||||||
{% csrf_token %}
|
|
||||||
{{form.as_p}}
|
|
||||||
<input type="submit" value="Donate" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.conf import settings
|
||||||
from regluit.core.feeds import SupporterWishlistFeed
|
from regluit.core.feeds import SupporterWishlistFeed
|
||||||
from regluit.core.models import Campaign
|
from regluit.core.models import Campaign
|
||||||
from regluit.frontend.views import GoodreadsDisplayView, LibraryThingView, PledgeView, PledgeCompleteView, PledgeCancelView, PledgeRechargeView, FAQView
|
from regluit.frontend.views import GoodreadsDisplayView, LibraryThingView, PledgeView, PledgeCompleteView, PledgeCancelView, PledgeRechargeView, FAQView
|
||||||
from regluit.frontend.views import CampaignListView, DonateView, WorkListView, UngluedListView, InfoPageView, InfoLangView, DonationView, FundPledgeView
|
from regluit.frontend.views import CampaignListView, WorkListView, UngluedListView, InfoPageView, InfoLangView, DonationView, FundPledgeView
|
||||||
from regluit.frontend.views import NonprofitCampaign, DonationCredit
|
from regluit.frontend.views import NonprofitCampaign, DonationCredit
|
||||||
|
|
||||||
urlpatterns = patterns(
|
urlpatterns = patterns(
|
||||||
|
@ -87,6 +87,5 @@ if settings.DEBUG:
|
||||||
"regluit.frontend.views",
|
"regluit.frontend.views",
|
||||||
url(r"^goodreads/$", login_required(GoodreadsDisplayView.as_view()), name="goodreads_display"),
|
url(r"^goodreads/$", login_required(GoodreadsDisplayView.as_view()), name="goodreads_display"),
|
||||||
url(r"^goodreads/clear_wishlist/$","clear_wishlist", name="clear_wishlist"),
|
url(r"^goodreads/clear_wishlist/$","clear_wishlist", name="clear_wishlist"),
|
||||||
url(r"^donate/$", DonateView.as_view(), name="donate"),
|
|
||||||
url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"),
|
url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"),
|
||||||
)
|
)
|
|
@ -1060,50 +1060,6 @@ class PledgeCancelView(FormView):
|
||||||
return HttpResponse("Sorry, something went wrong in canceling your campaign pledge. We have logged this error.")
|
return HttpResponse("Sorry, something went wrong in canceling your campaign pledge. We have logged this error.")
|
||||||
|
|
||||||
|
|
||||||
class DonateView(FormView):
|
|
||||||
template_name="donate.html"
|
|
||||||
form_class = DonateForm
|
|
||||||
|
|
||||||
#def get_context_data(self, **kwargs):
|
|
||||||
# context = super(DonateView, self).get_context_data(**kwargs)
|
|
||||||
#
|
|
||||||
# form = CampaignPledgeForm(data)
|
|
||||||
#
|
|
||||||
# context.update({'work':work,'campaign':campaign, 'premiums':premiums, 'form':form, 'premium_id':premium_id})
|
|
||||||
# return context
|
|
||||||
|
|
||||||
def form_valid(self, form):
|
|
||||||
donation_amount = form.cleaned_data["donation_amount"]
|
|
||||||
anonymous = form.cleaned_data["anonymous"]
|
|
||||||
|
|
||||||
# right now, if there is a non-zero pledge amount, go with that. otherwise, do the pre_approval
|
|
||||||
campaign = None
|
|
||||||
|
|
||||||
p = PaymentManager()
|
|
||||||
|
|
||||||
# we should force login at this point -- or if no account, account creation, login, and return to this spot
|
|
||||||
if self.request.user.is_authenticated():
|
|
||||||
user = self.request.user
|
|
||||||
else:
|
|
||||||
user = None
|
|
||||||
|
|
||||||
# instant payment: send to the partnering RH
|
|
||||||
receiver_list = [{'email':settings.PAYPAL_NONPROFIT_PARTNER_EMAIL, 'amount':donation_amount}]
|
|
||||||
|
|
||||||
#redirect the page back to campaign page on success
|
|
||||||
return_url = self.request.build_absolute_uri(reverse('donate'))
|
|
||||||
|
|
||||||
t, url = p.pledge('USD', receiver_list, campaign=campaign, list=None, user=user,
|
|
||||||
return_url=return_url, anonymous=anonymous, ack_name=ack_name,
|
|
||||||
ack_dedication=ack_dedication)
|
|
||||||
|
|
||||||
if url:
|
|
||||||
return HttpResponseRedirect(url)
|
|
||||||
else:
|
|
||||||
response = t.reference
|
|
||||||
logger.info("PledgeView paypal: Error " + str(t.reference))
|
|
||||||
return HttpResponse(response)
|
|
||||||
|
|
||||||
|
|
||||||
def claim(request):
|
def claim(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
|
|
Loading…
Reference in New Issue