/
models.py
61 lines (49 loc) · 2.09 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import datetime
from django.db import models
from markitup.fields import MarkupField
from symposion.conference.models import PresentationKind, PresentationCategory
class Proposal(models.Model):
AUDIENCE_LEVEL_NOVICE = 1
AUDIENCE_LEVEL_EXPERIENCED = 2
AUDIENCE_LEVEL_INTERMEDIATE = 3
AUDIENCE_LEVELS = [
(AUDIENCE_LEVEL_NOVICE, "Novice"),
(AUDIENCE_LEVEL_INTERMEDIATE, "Intermediate"),
(AUDIENCE_LEVEL_EXPERIENCED, "Experienced"),
]
DURATION_CHOICES = [
(0, "I don't care"),
(1, "I prefer a 30 minute slot"),
(2, "I prefer a 45 minute slot"),
]
title = models.CharField(max_length=100)
description = models.TextField(
max_length = 400, # @@@ need to enforce 400 in UI
help_text = "Brief one paragraph blurb (will be public if accepted). Must be 400 characters or less"
)
kind = models.ForeignKey(PresentationKind)
abstract = MarkupField(help_text = "More detailed description (will be public if accepted).")
categories = models.ManyToManyField(PresentationCategory)
audience_level = models.IntegerField(choices=AUDIENCE_LEVELS)
additional_notes = MarkupField(
blank=True,
help_text = "Anything else you'd like the program committee to know when making their selection: your past speaking experience, open source community experience, etc."
)
extreme = models.BooleanField(default=False)
duration = models.IntegerField(choices=DURATION_CHOICES)
submitted = models.DateTimeField(
default = datetime.datetime.now,
editable = False,
)
speaker = models.ForeignKey("speakers.Speaker", related_name="proposals")
additional_speakers = models.ManyToManyField("speakers.Speaker", blank=True)
cancelled = models.BooleanField(default=False)
def can_edit(self):
return self.kind in PresentationKind.available()
@property
def number(self):
return str(self.pk).zfill(3)
def speakers(self):
yield self.speaker
for speaker in self.additional_speakers.all():
yield speaker