bgneal@35: """ bgneal@35: Views for the donations application. bgneal@35: """ bgneal@35: from django.shortcuts import render_to_response bgneal@35: from django.template import RequestContext bgneal@35: from django.http import Http404 # TODO: remove bgneal@35: from django.conf import settings bgneal@35: from django.contrib.sites.models import Site bgneal@35: bgneal@35: from donations.models import Donation bgneal@35: bgneal@35: bgneal@35: def index(request): bgneal@35: gross, net, donations = Donation.objects.monthly_stats() bgneal@35: current_site = Site.objects.get_current() bgneal@35: bgneal@35: if settings.DEBUG: bgneal@35: form_action = 'https://www.sandbox.paypal.com/cgi-bin/webscr' bgneal@35: business = settings.DONATIONS_BUSINESS_DEBUG bgneal@35: else: bgneal@35: form_action = 'https://www.paypal.com/cgi-bin/webscr' bgneal@35: business = settings.DONATIONS_BUSINESS bgneal@35: bgneal@35: return render_to_response('donations/index.html', { bgneal@35: 'goal': settings.DONATIONS_GOAL, bgneal@35: 'gross': gross, bgneal@35: 'net': net, bgneal@35: 'left': settings.DONATIONS_GOAL - net, bgneal@35: 'donations': donations, bgneal@35: 'form_action': form_action, bgneal@35: 'business': business, bgneal@35: 'anonymous': settings.DONATIONS_ANON_NAME, bgneal@35: 'item_name': settings.DONATIONS_ITEM_NAME, bgneal@35: 'item_number': settings.DONATIONS_ITEM_NUM, bgneal@35: 'item_anon_number': settings.DONATIONS_ITEM_ANON_NUM, bgneal@35: 'domain': current_site.domain, bgneal@35: }, bgneal@35: context_instance = RequestContext(request)) bgneal@35: bgneal@35: bgneal@35: def ipn(request): bgneal@35: raise Http404 #TODO bgneal@35: bgneal@35: bgneal@35: def thanks(request): bgneal@35: raise Http404 #TODO