import datetime
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_init, post_save
from django.utils.translation import ugettext_lazy as _
@@ -141,24 +142,34 @@ def _check_level_change(sender, instance, created, **kwargs):
instance.reset_benefits()
post_save.connect(_check_level_change, sender=Sponsor)
BENEFIT_TYPE_CHOICES = [
("text", "Text"),
("richtext", "Rich Text"),
("file", "File"),
("weblogo", "Web Logo"),
("simple", "Simple")
("simple", "Simple"),
("option", "Option")
]
CONTENT_TYPE_CHOICES = [
] + [
("listing_text_%s" % lang, "Listing Text (%s)" % label) for lang, label in settings.LANGUAGES
class Benefit(models.Model):
name = models.CharField(_("name"), max_length=100)
description = models.TextField(_("description"), blank=True)
type = models.CharField(_("type"), choices=BENEFIT_TYPE_CHOICES, max_length=10,
default="simple")
type = models.CharField(_("type"), choices=BENEFIT_TYPE_CHOICES,
max_length=10, default="simple")
content_type = models.CharField(_("content type"), choices=CONTENT_TYPE_CHOICES,
max_length=20, default="simple")
def __unicode__(self):
return self.name
class BenefitLevel(models.Model):