From 92b91d2dbe968e364be347c2acbcbd6afe34edbe Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 6 Nov 2011 14:04:31 -0500 Subject: [PATCH] model for premiums --- core/fixtures/initial_data.json | 46 ++++++++++++++++++++++++++++++++- core/models.py | 7 +++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/core/fixtures/initial_data.json b/core/fixtures/initial_data.json index f2373fc9..19fda79c 100644 --- a/core/fixtures/initial_data.json +++ b/core/fixtures/initial_data.json @@ -6,5 +6,49 @@ "domain": "unglue.it", "name": "unglue.it" } - } + }, + { + "model": "core.premiums", + "pk": 1, + "fields": + { + "type": "00", + "campign": "", + "amount": 1, + "description": "The unglued ebook delivered to your inbox." + } + }, + { + "model": "core.premiums", + "pk": 2, + "fields": + { + "type": "00", + "campign": "", + "amount": 25, + "description": 'Your name under "supporters" in the acknowledgements section.' + } + }, + { + "model": "core.premiums", + "pk": 3, + "fields": + { + "type": "00", + "campign": "", + "amount": 50, + "description": 'Your name & link of your choice under "benefactors"' + } + }, + { + "model": "core.premiums", + "pk": 4, + "fields": + { + "type": "00", + "campign": "", + "amount": 100, + "description": 'Your name, link of your choice, & a brief message (140 characters max) under "bibliophiles"' + } + }, ] diff --git a/core/models.py b/core/models.py index 836c4979..e176b76d 100755 --- a/core/models.py +++ b/core/models.py @@ -9,6 +9,13 @@ from django.contrib.auth.models import User class UnglueitError(RuntimeError): pass +class Premium(models.Model) + PREMIUM_TYPES = ((u'00', u'Default'),(u'CU', u'Custom')) + type = = models.CharField(max_length=2, choices=PREMIUM_TYPES) + campaign = models.ForeignKey("Campaign", related_name="premiums", blank=True) + amount = models.DecimalField(max_digits=10, decimal_places=0, blank=False) + description = models.TextField(null=True, blank=False) + class Campaign(models.Model): created = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=500, null=True, blank=False)