Commits

Allan Davis committed b14d4e1

added view methods

Comments (0)

Files changed (2)

 # 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):
-    return render_to_response("index.html", {})
+    cause = Cause.objects.filter(active_donation_target_exact=True)[0]
+    donations = cause.donations.objects.order_by('-donation_date')[:20]
+    return render_to_response("index.html", {"cause": cause, "donations": donations})
 
 def checkout(request):
-    pass
+    amount = request.GET['amount']
+    form = DonationForm(inital={"amount":amount})
+    
+    return render_to_response("checkout.html", {"form":form})
 
 def process(request):
     pass

templates/checkout.html

+{% extends "base.html" %}
+
+{% block header %}
+{% endblock %}
+
+{%block content %}
+
+{% endblock%}