2016-07-13 17:13:47 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
from utils.models import CreatedUpdatedModel
|
|
|
|
|
|
|
|
|
|
|
|
class EventType(CreatedUpdatedModel):
|
2016-07-13 19:44:09 +00:00
|
|
|
""" Every event needs to have a type. """
|
2016-07-13 17:13:47 +00:00
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
slug = models.SlugField()
|
|
|
|
|
2016-07-13 20:37:20 +00:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
2016-07-13 17:13:47 +00:00
|
|
|
|
|
|
|
class Event(CreatedUpdatedModel):
|
2016-07-13 19:44:09 +00:00
|
|
|
""" Something that is on the program. """
|
2016-07-13 17:13:47 +00:00
|
|
|
title = models.CharField(max_length=255)
|
|
|
|
description = models.TextField()
|
2016-07-13 19:44:09 +00:00
|
|
|
event_type = models.ForeignKey(EventType)
|
|
|
|
days = models.ManyToManyField('camps.Day')
|
|
|
|
start = models.TimeField()
|
|
|
|
end = models.TimeField()
|
|
|
|
|
2016-07-13 20:37:20 +00:00
|
|
|
def __str__(self):
|
|
|
|
return self.title
|
|
|
|
|
2016-07-13 17:13:47 +00:00
|
|
|
|
|
|
|
class Speaker(CreatedUpdatedModel):
|
2016-07-13 19:44:09 +00:00
|
|
|
""" Person anchoring an event. """
|
2016-07-13 17:13:47 +00:00
|
|
|
name = models.CharField(max_length=150)
|
|
|
|
biography = models.TextField()
|
2016-07-13 19:44:09 +00:00
|
|
|
picture = models.ImageField(null=True, blank=True)
|
2016-07-13 17:13:47 +00:00
|
|
|
events = models.ManyToManyField(
|
|
|
|
Event,
|
|
|
|
related_name='speakers',
|
2016-07-13 19:44:09 +00:00
|
|
|
related_query_name='speaker'
|
|
|
|
)
|
2016-07-13 20:37:20 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|