From e2962e1075a3aac1f86ebf0bde27b6161d4052be Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 7 Jul 2012 18:13:05 -0400 Subject: [PATCH] [finish #30516251] supporter acknowledgement page basic version --- core/models.py | 23 +++ frontend/templates/front_matter.html | 16 +- frontend/templates/manage_campaign.html | 12 +- frontend/urls.py | 2 + frontend/views.py | 10 +- static/css/vanilla.css | 234 ++++++++++++++++++++++++ static/images/unglueitlogo.png | Bin 0 -> 12864 bytes 7 files changed, 290 insertions(+), 7 deletions(-) create mode 100755 static/css/vanilla.css create mode 100644 static/images/unglueitlogo.png diff --git a/core/models.py b/core/models.py index 7d465aa7..010c9e27 100755 --- a/core/models.py +++ b/core/models.py @@ -90,6 +90,7 @@ class RightsHolder(models.Model): class Premium(models.Model): PREMIUM_TYPES = ((u'00', u'Default'),(u'CU', u'Custom'),(u'XX', u'Inactive')) + TIERS = {"supporter":25, "patron":50, "bibliophile":100} #should load this from fixture created = models.DateTimeField(auto_now_add=True) type = models.CharField(max_length=2, choices=PREMIUM_TYPES) campaign = models.ForeignKey("Campaign", related_name="premiums", null=True) @@ -105,6 +106,7 @@ class Premium(models.Model): def premium_remaining(self): t_model=get_model('payment','Transaction') return self.limit - t_model.objects.filter(premium=self).count() + class CampaignAction(models.Model): timestamp = models.DateTimeField(auto_now_add=True) @@ -321,6 +323,27 @@ class Campaign(models.Model): def supporters_count(self): # avoid transmitting the whole list if you don't need to; let the db do the count. return self.transactions().filter(status=TRANSACTION_STATUS_ACTIVE).values_list('user', flat=True).distinct().count() + + def ungluers(self): + p = PaymentManager() + ungluers={"all":[],"supporters":[], "patrons":[], "bibliophiles":[]} + if self.status == "ACTIVE": + translist = p.query_campaign(self, summary=False, pledged=True, authorized=True) + elif self.status == "SUCCESSFUL": + translist = p.query_campaign(self, summary=False, pledged=True, completed=True) + else: + translist = [] + for transaction in translist: + ungluers['all'].append(transaction.user) + if not transaction.anonymous: + if transaction.amount >= Premium.TIERS["bibliophile"]: + ungluers['bibliophiles'].append(transaction.user) + elif transaction.amount >= Premium.TIERS["patron"]: + ungluers['patrons'].append(transaction.user) + elif transaction.amount >= Premium.TIERS["supporter"]: + ungluers['supporters'].append(transaction.user) + + return ungluers def effective_premiums(self): """returns the available premiums for the Campaign including any default premiums""" diff --git a/frontend/templates/front_matter.html b/frontend/templates/front_matter.html index 485e6401..8975d738 100644 --- a/frontend/templates/front_matter.html +++ b/frontend/templates/front_matter.html @@ -1,7 +1,14 @@ +{% extends "basedocumentation.html" %} +{% block title %}Open Access eBooks{% endblock %} +{% block extra_extra_head %} + +{% endblock %} +{% block doccontent %} +