changeset 33:c018872385ea

Slideshow for home page; Initial checkin for the donations application.
author Brian Neal <bgneal@gmail.com>
date Wed, 03 Jun 2009 00:59:17 +0000
parents 07da6967fc40
children d5d7e510ecd7
files gpp/donations/__init__.py gpp/donations/admin.py gpp/donations/models.py gpp/donations/tests.py gpp/donations/views.py gpp/settings.py gpp/templates/home.html media/css/base.css
diffstat 7 files changed, 104 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpp/donations/admin.py	Wed Jun 03 00:59:17 2009 +0000
@@ -0,0 +1,10 @@
+"""
+This file contains the admin definitions for the donations application.
+"""
+from django.contrib import admin
+from donations.models import Donation
+
+class DonationAdmin(admin.ModelAdmin):
+    raw_id_fields = ('user', )
+
+admin.site.register(Donation, DonationAdmin)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpp/donations/models.py	Wed Jun 03 00:59:17 2009 +0000
@@ -0,0 +1,36 @@
+"""
+Models for the donations application.
+"""
+from django.db import models
+from django.contrib import auth
+
+class Donation(models.Model):
+    """Model to represent a donation to the website."""
+
+    user = models.ForeignKey(auth.models.User, null=True, blank=True)
+    is_anonymous = models.BooleanField()
+    test_ipn = models.BooleanField(default=False, verbose_name="Test IPN")
+    txn_id = models.CharField(max_length=20, verbose_name="Txn ID")
+    txn_type = models.CharField(max_length=64)
+    first_name = models.CharField(max_length=64, blank=True)
+    last_name = models.CharField(max_length=64, blank=True)
+    payer_email = models.EmailField(max_length=127, blank=True)
+    payer_id = models.CharField(max_length=13, blank=True, verbose_name="Payer ID")
+    mc_fee = models.DecimalField(max_digits=8, decimal_places=2, verbose_name="Fee")
+    mc_gross = models.DecimalField(max_digits=8, decimal_places=2, verbose_name="Gross")
+    memo = models.TextField(blank=True)
+    payer_status = models.CharField(max_length=10, blank=True)
+    payment_date = models.DateTimeField()
+
+    class Meta:
+        ordering = ('-payment_date', )
+
+    def __unicode__(self):
+        if self.user:
+            return u'%s from %s' % (self.mc_gross, self.user.username)
+        return u'%s from %s %s' % (self.mc_gross, self.first_name, self.last_name)
+
+    def save(self, *args, **kwargs):
+        if self.user is None:
+            self.is_anonymous = True
+        super(Donation, self).save(*args, **kwargs)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpp/donations/tests.py	Wed Jun 03 00:59:17 2009 +0000
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gpp/donations/views.py	Wed Jun 03 00:59:17 2009 +0000
@@ -0,0 +1,1 @@
+# Create your views here.
--- a/gpp/settings.py	Tue May 05 00:56:18 2009 +0000
+++ b/gpp/settings.py	Wed Jun 03 00:59:17 2009 +0000
@@ -106,6 +106,7 @@
     'comments',
     'contact',
     'core',
+    'donations',
     'downloads',
     'gcalendar',
     'irc',
--- a/gpp/templates/home.html	Tue May 05 00:56:18 2009 +0000
+++ b/gpp/templates/home.html	Wed Jun 03 00:59:17 2009 +0000
@@ -7,8 +7,21 @@
 {% block custom_css %}
 <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/news.css" />
 {% endblock %}
+{% block custom_js %}
+<script type="text/javascript" src="{{ MEDIA_URL }}js/slideshow.js"></script>
+{% endblock %}
 {% block content %}
 <h2>Welcome to SurfGuitar101!</h2>
+<div class="span-9">
+   <div id="slideshow">
+   <img src="{{ MEDIA_URL }}slideshow/image-1.jpg" alt="Slideshow Image 1" class="active" />
+   <img src="{{ MEDIA_URL }}slideshow/image-2.jpg" alt="Slideshow Image 2" />
+   <img src="{{ MEDIA_URL }}slideshow/image-3.jpg" alt="Slideshow Image 3" />
+   <img src="{{ MEDIA_URL }}slideshow/image-4.jpg" alt="Slideshow Image 4" />
+   <img src="{{ MEDIA_URL }}slideshow/image-5.jpg" alt="Slideshow Image 5" />
+   </div>
+</div>
+<div class="span-10 last">
 <p>You are looking at a test version of the new SurfGuitar101 website, dubbed <strong>SG101 2.0</strong>. 
 All major functionality is here except for the forums (which are still in development). 
 The purpose of this test site is to test the new site software, to get feedback from the user base, and 
@@ -17,6 +30,7 @@
 to sign up here and give the new site a test drive. Any and all feedback is appreciated! Thank you for
 helping to make this site be the best home on the web for fans and friends of surf music!
 </p>
+</div>
 <p>Remember that this is a test site, and not everything is going to work. Nothing here is
 permanent. The site (content, user accounts, etc.) may be wiped at any time while we fix bugs and add features. 
 Also, I hope that the look and feel of this site can be greatly improved to something really cool! I'll need
--- a/media/css/base.css	Tue May 05 00:56:18 2009 +0000
+++ b/media/css/base.css	Wed Jun 03 00:59:17 2009 +0000
@@ -131,3 +131,22 @@
 ul.icon-list li {
    list-style-type: none;
 }
+#slideshow {
+   position:relative;
+   left:15px;
+   height:240px;
+}
+#slideshow img {
+   position:absolute;
+   top:0;
+   left:0;
+   z-index:8;
+   opacity:0.0;
+}
+#slideshow img.active {
+   z-index:10;
+   opacity:1.0;
+}
+#slideshow img.last-active {
+   z-index:9;
+}