summaryrefslogtreecommitdiff
path: root/postgresqleu/confreg/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'postgresqleu/confreg/models.py')
-rw-r--r--postgresqleu/confreg/models.py41
1 files changed, 39 insertions, 2 deletions
diff --git a/postgresqleu/confreg/models.py b/postgresqleu/confreg/models.py
index 1e175aac..ec04ddbe 100644
--- a/postgresqleu/confreg/models.py
+++ b/postgresqleu/confreg/models.py
@@ -50,11 +50,16 @@ STATUS_CHOICES_LONG = (
(3, "Pending speaker confirmation"), # Approved, but not confirmed
(4, "Reserve-listed in case of cancels/changes"), # Reserve list
)
+
+
def get_status_string(val):
return (t for v, t in STATUS_CHOICES if v == val).next()
+
+
def get_status_string_long(val):
return (t for v, t in STATUS_CHOICES_LONG if v == val).next()
+
valid_status_transitions = {
0: {3: 'Talk approved', 2: 'Talk is rejected', 4: 'Talk added to reserve list'},
1: {2: 'Talk withdrawn', },
@@ -63,6 +68,7 @@ valid_status_transitions = {
4: {1: 'Last-minute reservelist', 3: 'Activated from reservelist'},
}
+
def color_validator(value):
if not value.startswith('#'):
raise ValidationError('Color values must start with #')
@@ -74,6 +80,7 @@ def color_validator(value):
except ValueError:
raise ValidationError('Invalid value in color specification')
+
class ConferenceSeries(models.Model):
name = models.CharField(max_length=64, blank=False, null=False)
sortkey = models.IntegerField(null=False, default=100)
@@ -88,6 +95,7 @@ class ConferenceSeries(models.Model):
ordering = ('sortkey', 'name')
verbose_name_plural = "Conference series"
+
class ConferenceSeriesOptOut(models.Model):
# Users opting out of communications about a specific conference
series = models.ForeignKey(ConferenceSeries, null=False, blank=False, on_delete=models.CASCADE)
@@ -98,6 +106,7 @@ class ConferenceSeriesOptOut(models.Model):
('user', 'series'),
)
+
class GlobalOptOut(models.Model):
# Users who are opting out of *all* future communications
user = models.OneToOneField(User, null=False, blank=False, primary_key=True, on_delete=models.CASCADE)
@@ -234,6 +243,7 @@ class Conference(models.Model):
raise ValidationError("Must specify an actual welcome mail if it's enabled!")
return cc
+
class RegistrationClass(models.Model):
conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
regclass = models.CharField(max_length=64, null=False, blank=False, verbose_name="Registration class")
@@ -274,6 +284,7 @@ class RegistrationClass(models.Model):
d = dict((a, getattr(self, a) and unicode(getattr(self, a))) for a in attribs)
return d
+
class RegistrationDay(models.Model):
conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
day = models.DateField(null=False, blank=False)
@@ -291,6 +302,7 @@ class RegistrationDay(models.Model):
df = DateFormat(self.day)
return df.format('D jS')
+
class RegistrationType(models.Model):
conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
regtype = models.CharField(max_length=64, null=False, blank=False, verbose_name="Registration type")
@@ -340,6 +352,7 @@ class RegistrationType(models.Model):
d['days'] = [dd.day.strftime('%Y-%m-%d') for dd in self.days.all()]
return d
+
class ShirtSize(models.Model):
shirtsize = models.CharField(max_length=32)
sortkey = models.IntegerField(default=100, null=False, blank=False)
@@ -350,6 +363,7 @@ class ShirtSize(models.Model):
class Meta:
ordering = ('sortkey', 'shirtsize',)
+
class ConferenceAdditionalOption(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
name = models.CharField(max_length=100, null=False, blank=False)
@@ -383,6 +397,7 @@ class ConferenceAdditionalOption(models.Model):
self.maxcount)
return "%s%s" % (self.name, coststr)
+
class BulkPayment(models.Model):
# User that owns this bulk payment
user = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
@@ -425,6 +440,7 @@ class BulkPayment(models.Model):
self.invoice.total_amount,
self.paidat and 'Paid' or 'Not paid yet')
+
class ConferenceRegistration(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
regtype = models.ForeignKey(RegistrationType, null=True, blank=True, verbose_name="Registration type", on_delete=models.CASCADE)
@@ -549,6 +565,7 @@ class ConferenceRegistration(models.Model):
d['additionaloptions'] = [{'id': ao.id, 'name': ao.name} for ao in self.additionaloptions.all()]
return d
+
class RegistrationWaitlistEntry(models.Model):
registration = models.OneToOneField(ConferenceRegistration, primary_key=True, on_delete=models.CASCADE)
enteredon = models.DateTimeField(null=False, blank=False, auto_now_add=True)
@@ -561,6 +578,7 @@ class RegistrationWaitlistEntry(models.Model):
def offers_made(self):
return self.registrationwaitlisthistory_set.filter(text__startswith='Made offer').count()
+
class RegistrationWaitlistHistory(models.Model):
waitlist = models.ForeignKey(RegistrationWaitlistEntry, null=False, blank=False, on_delete=models.CASCADE)
time = models.DateTimeField(null=False, blank=False, auto_now_add=True)
@@ -569,6 +587,7 @@ class RegistrationWaitlistHistory(models.Model):
class Meta:
ordering = ('-time',)
+
class Track(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
trackname = models.CharField(max_length=100, null=False, blank=False, verbose_name="Track name")
@@ -581,6 +600,7 @@ class Track(models.Model):
def __unicode__(self):
return self.trackname
+
class Room(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
roomname = models.CharField(max_length=20, null=False, blank=False, verbose_name="Room name")
@@ -598,6 +618,7 @@ class Room(models.Model):
def _get_upload_path(instance, filename):
return "%s" % instance.id
+
class Speaker(models.Model):
user = models.OneToOneField(User, null=True, blank=True, unique=True, on_delete=models.CASCADE)
fullname = models.CharField(max_length=100, null=False, blank=False)
@@ -636,11 +657,13 @@ class Speaker(models.Model):
class Meta:
ordering = ['fullname', ]
+
class DeletedItems(models.Model):
itemid = models.IntegerField(null=False, blank=False)
type = models.CharField(max_length=16, blank=False, null=False)
deltime = models.DateTimeField(blank=False, null=False)
+
class Speaker_Photo(models.Model):
speaker = models.OneToOneField(Speaker, db_column='id', primary_key=True, on_delete=models.CASCADE)
photo = models.TextField(null=False, blank=False)
@@ -654,6 +677,7 @@ class Speaker_Photo(models.Model):
self.speaker.save()
super(Speaker_Photo, self).delete()
+
class ConferenceSessionScheduleSlot(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
starttime = models.DateTimeField(null=False, blank=False, verbose_name="Start time")
@@ -662,6 +686,7 @@ class ConferenceSessionScheduleSlot(models.Model):
def __unicode__(self):
return "%s - %s" % (self.starttime, self.endtime)
+
class ConferenceSession(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
speaker = models.ManyToManyField(Speaker, blank=True, verbose_name="Speakers")
@@ -749,6 +774,7 @@ class ConferenceSession(models.Model):
class Meta:
ordering = ['starttime', ]
+
class ConferenceSessionSlides(models.Model):
session = models.ForeignKey(ConferenceSession, null=False, blank=False, on_delete=models.CASCADE)
name = models.CharField(max_length=100, null=False, blank=False)
@@ -757,6 +783,7 @@ class ConferenceSessionSlides(models.Model):
_safe_attributes = ('id', 'name', 'url', 'content')
+
class ConferenceSessionVote(models.Model):
session = models.ForeignKey(ConferenceSession, null=False, blank=False, on_delete=models.CASCADE)
voter = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
@@ -766,6 +793,7 @@ class ConferenceSessionVote(models.Model):
class Meta:
unique_together = (('session', 'voter',), )
+
class ConferenceSessionFeedback(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
session = models.ForeignKey(ConferenceSession, null=False, blank=False, on_delete=models.CASCADE)
@@ -780,6 +808,7 @@ class ConferenceSessionFeedback(models.Model):
def __unicode__(self):
return unicode("%s - %s (%s)") % (self.conference, self.session, self.attendee)
+
class ConferenceFeedbackQuestion(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
question = models.CharField(max_length=100, null=False, blank=False)
@@ -794,6 +823,7 @@ class ConferenceFeedbackQuestion(models.Model):
class Meta:
ordering = ['conference', 'sortkey', ]
+
class ConferenceFeedbackAnswer(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
question = models.ForeignKey(ConferenceFeedbackQuestion, null=False, blank=False, on_delete=models.CASCADE)
@@ -807,6 +837,7 @@ class ConferenceFeedbackAnswer(models.Model):
class Meta:
ordering = ['conference', 'attendee', 'question', ]
+
class VolunteerSlot(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
timerange = DateTimeRangeField(null=False, blank=False)
@@ -844,6 +875,7 @@ class VolunteerSlot(models.Model):
self._localtz = pytz.timezone(settings.TIME_ZONE)
return self._localtz.localize(time).astimezone(pytz.utc)
+
class VolunteerAssignment(models.Model):
slot = models.ForeignKey(VolunteerSlot, null=False, blank=False, on_delete=models.CASCADE)
reg = models.ForeignKey(ConferenceRegistration, null=False, blank=False, on_delete=models.CASCADE)
@@ -852,6 +884,7 @@ class VolunteerAssignment(models.Model):
_safe_attributes = ('id', 'slot', 'reg', 'vol_confirmed', 'org_confirmed')
+
class PrepaidBatch(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
regtype = models.ForeignKey(RegistrationType, null=False, blank=False, on_delete=models.CASCADE)
@@ -866,6 +899,7 @@ class PrepaidBatch(models.Model):
verbose_name_plural = "Prepaid batches"
ordering = ['conference', 'id', ]
+
class PrepaidVoucher(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
vouchervalue = models.CharField(max_length=100, null=False, blank=False, unique=True)
@@ -879,6 +913,7 @@ class PrepaidVoucher(models.Model):
class Meta:
ordering = ['batch', 'vouchervalue', ]
+
class DiscountCode(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
code = models.CharField(max_length=100, null=False, blank=False)
@@ -908,6 +943,7 @@ class DiscountCode(models.Model):
def count(self):
return self.registrations.count()
+
class AttendeeMail(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
regclasses = models.ManyToManyField(RegistrationClass, blank=False)
@@ -934,7 +970,6 @@ class PendingAdditionalOrder(models.Model):
return u"%s" % (self.reg, )
-
class AggregatedTshirtSizes(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
size = models.ForeignKey(ShirtSize, null=False, blank=False, on_delete=models.CASCADE)
@@ -943,6 +978,7 @@ class AggregatedTshirtSizes(models.Model):
class Meta:
unique_together = (('conference', 'size'), )
+
class AggregatedDietary(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
dietary = models.CharField(max_length=100, null=False, blank=False)
@@ -960,6 +996,7 @@ AccessTokenPermissions = (
('addopts', 'Additional options and counts'),
)
+
class AccessToken(models.Model):
conference = models.ForeignKey(Conference, null=False, blank=False, on_delete=models.CASCADE)
token = models.CharField(max_length=200, null=False, blank=False)
@@ -978,7 +1015,6 @@ class AccessToken(models.Model):
return ", ".join(self.permissions)
-
class ConferenceNews(models.Model):
conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
datetime = models.DateTimeField(blank=False, default=datetime.datetime.now)
@@ -995,6 +1031,7 @@ class ConferenceNews(models.Model):
ordering = ['-datetime', ]
verbose_name_plural = 'Conference News'
+
class ConferenceTweetQueue(models.Model):
conference = models.ForeignKey(Conference, null=False, on_delete=models.CASCADE)
datetime = models.DateTimeField(blank=False, default=datetime.datetime.now)