1 | from django.db import models
|
---|
2 | from django.contrib.auth.models import User
|
---|
3 | from datetime import date
|
---|
4 |
|
---|
5 | class PerformanceGroup(models.Model):
|
---|
6 | "Any sort of performance group, such as an a cappella group, a dance troupe, theater group, etc."
|
---|
7 | college = models.ForeignKey(College)
|
---|
8 | name = models.CharField(max_length=50, verbose_name="group name")
|
---|
9 | style = models.CharField(max_length=50, help_text="A theme or idea that characterizes this group.", blank=True)
|
---|
10 | description = models.TextField()
|
---|
11 | members = models.ManyToManyField(User, through='PerformanceGroupMembership')
|
---|
12 | date_founded = models.DateField(help_text="May be an approximate date.")
|
---|
13 | email = models.EmailField(blank=True)
|
---|
14 | external_site = models.URLField(blank=True)
|
---|
15 | tags = TagField(blank=True)
|
---|
16 |
|
---|
17 | def __unicode__(self):
|
---|
18 | return self.name
|
---|
19 |
|
---|
20 | class PerformanceGroupMembership(models.Model):
|
---|
21 | "A member of a PerformanceGroup. Maintains current members (date_left is blank) as well as alumni (date_left has a value)."
|
---|
22 | user = models.ForeignKey(User)
|
---|
23 | performance_group = models.ForeignKey(PerformanceGroup)
|
---|
24 | date_joined = models.DateField() #default=date.today.__str__)
|
---|
25 | date_left = models.DateField(blank=True, default='')
|
---|
26 | title = models.CharField(max_length=50, blank=True, default='')
|
---|