1. Allan Davis
  2. pixels_for_food

Source

pixels_for_food / pixels / views.py

# Create your views here.
from django.shortcuts import render_to_response
from models import Cause
from models import Donation
from forms import DonationForm

def index(request):
    cause = Cause.objects.filter(active_donation_target=True)[0]
    #if(cause.donations):
    #    donations = cause.donations.objects.order_by('-donation_date')[:20]
    #else:
    #    donations = []
    params = {
        "cause": cause,
        #"donations": donations,
        }
    return render_to_response("index.html", params )

def checkout(request):
    amount = request.POST['amount']
    lbs = request.POST['lbs']
    form = DonationForm() #initial={"amount":amount}
    params = {
        "form":form,
        "amount":amount,
        "pounds":lbs,
        }
    return render_to_response("checkout.html", params)

def process(request):
    pass