2012-02-05 20:03:30 +00:00
|
|
|
import datetime
|
|
|
|
|
|
|
|
from django.db import models
|
2012-02-22 22:35:21 +00:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2012-02-05 20:03:30 +00:00
|
|
|
|
2012-02-06 03:50:47 +00:00
|
|
|
from conference.models import Conference
|
|
|
|
|
2012-02-05 20:03:30 +00:00
|
|
|
|
|
|
|
class SponsorLevel(models.Model):
|
|
|
|
|
2012-02-22 22:35:21 +00:00
|
|
|
conference = models.ForeignKey(Conference, verbose_name=_("conference"))
|
|
|
|
name = models.CharField(_("name"), max_length=100)
|
|
|
|
order = models.IntegerField(_("order"), default=0)
|
|
|
|
description = models.TextField(_("description"), blank=True)
|
2012-02-05 20:03:30 +00:00
|
|
|
|
|
|
|
class Meta:
|
2012-02-06 03:50:47 +00:00
|
|
|
ordering = ["conference", "order"]
|
2012-02-22 22:35:21 +00:00
|
|
|
verbose_name = _("sponsor level")
|
|
|
|
verbose_name_plural = _("sponsor levels")
|
2012-02-05 20:03:30 +00:00
|
|
|
|
|
|
|
def __unicode__(self):
|
2012-02-06 03:50:47 +00:00
|
|
|
return u"%s %s" % (self.conference, self.name)
|
2012-02-05 22:13:06 +00:00
|
|
|
|
|
|
|
def sponsors(self):
|
|
|
|
return self.sponsor_set.filter(active=True).order_by("added")
|
2012-02-05 20:03:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Sponsor(models.Model):
|
|
|
|
|
2012-02-22 22:35:21 +00:00
|
|
|
name = models.CharField(_("name"), max_length=100)
|
|
|
|
external_url = models.URLField(_("external URL"))
|
|
|
|
annotation = models.TextField(_("annotation"), blank=True)
|
|
|
|
contact_name = models.CharField(_("contact_name"), max_length=100)
|
|
|
|
contact_email = models.EmailField(_(u"Contact e\u2011mail"))
|
|
|
|
logo = models.ImageField(_("logo"), upload_to="sponsor_logos/")
|
|
|
|
level = models.ForeignKey(SponsorLevel, verbose_name=_("level"))
|
|
|
|
added = models.DateTimeField(_("added"), default=datetime.datetime.now)
|
|
|
|
active = models.BooleanField(_("active"), default=False)
|
2012-02-05 20:03:30 +00:00
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
2012-02-22 22:35:21 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
verbose_name = _("sponsor")
|
|
|
|
verbose_name_plural = _("sponsors")
|