2015-10-05 16:35:30 +00:00
|
|
|
import datetime
|
2015-10-03 01:07:05 +00:00
|
|
|
from django.db import models
|
2016-05-30 19:51:17 +00:00
|
|
|
from utils.models import UUIDModel, CreatedUpdatedModel
|
2017-01-20 15:18:10 +00:00
|
|
|
from program.models import EventType
|
|
|
|
from django.contrib.postgres.fields import DateTimeRangeField
|
2015-10-03 01:07:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Camp(CreatedUpdatedModel, UUIDModel):
|
|
|
|
class Meta:
|
2016-12-25 14:52:55 +00:00
|
|
|
verbose_name = 'Camp'
|
|
|
|
verbose_name_plural = 'Camps'
|
2015-10-03 01:07:05 +00:00
|
|
|
|
2016-12-25 14:52:55 +00:00
|
|
|
title = models.CharField(
|
|
|
|
verbose_name='Title',
|
|
|
|
help_text='Title of the camp, ie. Bornhack 2016.',
|
2015-10-03 01:07:05 +00:00
|
|
|
max_length=255,
|
|
|
|
)
|
|
|
|
|
2016-12-25 14:52:55 +00:00
|
|
|
tagline = models.CharField(
|
|
|
|
verbose_name='Tagline',
|
|
|
|
help_text='Tagline of the camp, ie. "Initial Commit"',
|
|
|
|
max_length=255,
|
2015-10-03 01:07:05 +00:00
|
|
|
)
|
|
|
|
|
2016-12-25 14:52:55 +00:00
|
|
|
slug = models.SlugField(
|
|
|
|
verbose_name='Url Slug',
|
|
|
|
help_text='The url slug to use for this camp'
|
2015-10-03 01:07:05 +00:00
|
|
|
)
|
|
|
|
|
2017-01-20 15:18:10 +00:00
|
|
|
buildup = DateTimeRangeField(
|
|
|
|
verbose_name='Buildup Period',
|
|
|
|
help_text='The camp buildup period.',
|
2016-05-06 20:33:59 +00:00
|
|
|
)
|
|
|
|
|
2017-01-20 15:18:10 +00:00
|
|
|
camp = DateTimeRangeField(
|
|
|
|
verbose_name='Camp Period',
|
|
|
|
help_text='The camp period.',
|
2016-12-25 14:52:55 +00:00
|
|
|
)
|
2015-10-05 16:35:30 +00:00
|
|
|
|
2017-01-20 15:18:10 +00:00
|
|
|
teardown = DateTimeRangeField(
|
|
|
|
verbose_name='Teardown period',
|
|
|
|
help_text='The camp teardown period.',
|
2015-10-05 16:35:30 +00:00
|
|
|
)
|
|
|
|
|
2016-12-25 14:52:55 +00:00
|
|
|
def __unicode__(self):
|
|
|
|
return "%s - %s" % (self.title, self.tagline)
|
2016-07-13 19:44:09 +00:00
|
|
|
|
2017-01-20 15:18:10 +00:00
|
|
|
@property
|
|
|
|
def event_types(self):
|
|
|
|
# return all event types with at least one event in this camp
|
|
|
|
return EventType.objects.filter(event__instances__isnull=False, event__camp=self).distinct()
|
2015-10-03 01:07:05 +00:00
|
|
|
|
2017-01-20 15:18:10 +00:00
|
|
|
@property
|
|
|
|
def logo_small(self):
|
|
|
|
return 'img/%(slug)s/logo/%(slug)s-logo-small.png' % {'slug': self.slug}
|
2015-10-03 01:07:05 +00:00
|
|
|
|
2017-01-20 15:18:10 +00:00
|
|
|
@property
|
|
|
|
def logo_large(self):
|
|
|
|
return 'img/%(slug)s/logo/%(slug)s-logo-large.png' % {'slug': self.slug}
|
2016-12-25 14:52:55 +00:00
|
|
|
|