1. Allan Davis
  2. pixels_for_food

Commits

Allan Davis  committed b14d4e1

added view methods

  • Participants
  • Parent commits 83979f1
  • Branches default

Comments (0)

Files changed (2)

File pixels/views.py

View file
 # 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

File templates/checkout.html

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