model for premiums

pull/1/head
eric 2011-11-06 14:04:31 -05:00
parent f428634bf7
commit 92b91d2dbe
2 changed files with 52 additions and 1 deletions

View File

@ -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"'
}
},
]

View File

@ -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)