summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-02-27 11:38:02 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-02-27 11:38:02 (GMT)
commit36d8f7e5604f62bb51dcdb4dee4cc013bd0abda2 (patch)
tree8eb8aab36c2ca8f362b0f1bf555b7d229c88a136
First commit
-rw-r--r--.gitignore2
-rw-r--r--LICENSE27
-rw-r--r--README1
-rw-r--r--README.rst7
-rw-r--r--__init__.py0
-rwxr-xr-xmanage.py11
-rw-r--r--program/__init__.py0
-rw-r--r--program/admin.py56
-rw-r--r--program/fixtures/broadcastformats.yaml35
-rw-r--r--program/fixtures/musicfocus.yaml60
-rw-r--r--program/fixtures/rrules.yaml25
-rw-r--r--program/fixtures/showinformation.yaml48
-rw-r--r--program/fixtures/showtopics.yaml30
-rw-r--r--program/management/__init__.py2
-rw-r--r--program/management/commands/__init__.py2
-rw-r--r--program/models.py242
-rw-r--r--program/tests.py0
-rw-r--r--program/urls.py14
-rw-r--r--program/views.py17
-rw-r--r--settings.py94
-rw-r--r--templates/404.html7
-rw-r--r--templates/500.html11
-rw-r--r--templates/base.html11
-rw-r--r--templates/program/host_detail.html13
-rw-r--r--templates/program/host_list.html15
-rw-r--r--templates/program/show_detail.html54
-rw-r--r--templates/program/show_list.html76
-rw-r--r--templates/program/timeslot_detail.html53
-rw-r--r--urls.py9
29 files changed, 922 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3011f78
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+*.sqlite \ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..5596645
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2011, Ernesto Rico-Schmidt
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+Neither the name of the author nor the names of its contributors may be
+used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README b/README
new file mode 100644
index 0000000..feda122
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+This file was created by PyCharm 1.1.1 for binding GitHub repository \ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..ab50e53
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,7 @@
+Requirements
+============
+
+- Django 1.3: http://www.djangoproject.com/download/
+- PIL: http://www.pythonware.com/products/pil/
+- python-dateutil: http://pypi.python.org/pypi/python-dateutil/1.5
+- PyYAML: http://pypi.python.org/pypi/PyYAML/3.09
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/__init__.py
diff --git a/manage.py b/manage.py
new file mode 100755
index 0000000..5e78ea9
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+from django.core.management import execute_manager
+try:
+ import settings # Assumed to be in the same directory.
+except ImportError:
+ import sys
+ sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+ sys.exit(1)
+
+if __name__ == "__main__":
+ execute_manager(settings)
diff --git a/program/__init__.py b/program/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/program/__init__.py
diff --git a/program/admin.py b/program/admin.py
new file mode 100644
index 0000000..642beaf
--- /dev/null
+++ b/program/admin.py
@@ -0,0 +1,56 @@
+from django.contrib import admin
+
+from models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic, Host, Note, ProgramSlot, Show, TimeSlot
+
+class BroadcastFormatAdmin(admin.ModelAdmin):
+ list_display = ('format',)
+ prepopulated_fields = {'slug': ('format',)}
+
+class MusicFocusAdmin(admin.ModelAdmin):
+ list_display = ('focus', 'abbrev')
+ prepopulated_fields = {'slug': ('focus',)}
+
+class ShowInformationAdmin(admin.ModelAdmin):
+ list_display = ('information', 'abbrev')
+ prepopulated_fields = {'slug': ('information',)}
+
+class ShowTopicAdmin(admin.ModelAdmin):
+ list_display = ('topic', 'abbrev')
+ prepopulated_fields = {'slug': ('topic',)}
+
+class NoteAdmin(admin.ModelAdmin):
+ list_filter = ('status',)
+ ordering = ('time_slot',)
+
+class TimeSlotInline(admin.TabularInline):
+ model = TimeSlot
+
+class ProgramSlotAdmin(admin.ModelAdmin):
+ date_hierarchy = 'dstart'
+ inlines = (TimeSlotInline,)
+ list_display = ('show', 'byweekday', 'rrule', 'tstart', 'tend', 'dstart', 'until')
+ list_filter = ('byweekday', 'rrule', 'is_repetition')
+ ordering = ('byweekday', 'dstart')
+ search_fields = ('show__name',)
+
+class ProgramSlotInline(admin.TabularInline):
+ model = ProgramSlot
+
+class ShowAdmin(admin.ModelAdmin):
+ filter_horizontal = ('hosts', 'owners', 'music_focus', 'show_information', 'show_topic')
+ inlines = (ProgramSlotInline,)
+ list_display = ('name', 'short_description', 'broadcast_format')
+ list_filter = ('broadcast_format', 'show_information', 'show_topic', 'music_focus',)
+ ordering = ('slug',)
+ prepopulated_fields = {'slug': ('name',)}
+ search_fields = ('name', 'short_description', 'description')
+
+admin.site.register(BroadcastFormat, BroadcastFormatAdmin)
+admin.site.register(MusicFocus, MusicFocusAdmin)
+admin.site.register(ShowInformation, ShowInformationAdmin)
+admin.site.register(ShowTopic, ShowTopicAdmin)
+admin.site.register(Note, NoteAdmin)
+admin.site.register(ProgramSlot, ProgramSlotAdmin)
+admin.site.register(Show, ShowAdmin)
+
+admin.site.register(Host) \ No newline at end of file
diff --git a/program/fixtures/broadcastformats.yaml b/program/fixtures/broadcastformats.yaml
new file mode 100644
index 0000000..b6827aa
--- /dev/null
+++ b/program/fixtures/broadcastformats.yaml
@@ -0,0 +1,35 @@
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Talk
+ slug: talk
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Musiksendung
+ slug: musiksendung
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Unmoderiertes Musikprogramm
+ slug: unmoderiertes-musikprogramm
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Feature/Magazin
+ slug: feature-magazin
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Experimentell
+ slug: experimentell
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Hörspiel/Literatur
+ slug: horspiel-literatur
+- model: program.broadcastformat
+ pk:
+ fields:
+ format: Vortrag/Diskussion
+ slug: vortrag-diskussion \ No newline at end of file
diff --git a/program/fixtures/musicfocus.yaml b/program/fixtures/musicfocus.yaml
new file mode 100644
index 0000000..72a9dd9
--- /dev/null
+++ b/program/fixtures/musicfocus.yaml
@@ -0,0 +1,60 @@
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Jazz
+ abbrev: J
+ slug: jazz
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Volksmusik/Folk
+ abbrev: V
+ slug: volksmusik-folk
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Experimentelle Musik
+ abbrev: Ex
+ slug: expermentelle-musik
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Rock/Indie
+ abbrev: R
+ slug: rock-indie
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Metal/Hardrock
+ abbrev: M
+ slug: metal-hardrock
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Electronic
+ abbrev: E
+ slug: electronic
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Klassik
+ abbrev: K
+ slug: klassik
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Oldies
+ abbrev: O
+ slug: oldies
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Reggae/Ska
+ abbrev: Re
+ slug: reggae-ska
+- model: program.musicfocus
+ pk:
+ fields:
+ focus: Hiphop
+ abbrev: H
+ slug: hiphop \ No newline at end of file
diff --git a/program/fixtures/rrules.yaml b/program/fixtures/rrules.yaml
new file mode 100644
index 0000000..1f09e6a
--- /dev/null
+++ b/program/fixtures/rrules.yaml
@@ -0,0 +1,25 @@
+- model: program.rrule
+ pk:
+ fields:
+ name: einmalig
+ freq: 0
+ count: 1
+ bysetpos: 1
+- model: program.rrule
+ pk:
+ fields:
+ name: wöchentlich
+ freq: 2
+ interval: 1
+- model: program.rrule
+ pk:
+ fields:
+ name: zweiwöchentlich
+ freq: 2
+ interval: 2
+- model: program.rrule
+ pk:
+ fields:
+ name: vierwöchentlich
+ freq: 2
+ interval: 4 \ No newline at end of file
diff --git a/program/fixtures/showinformation.yaml b/program/fixtures/showinformation.yaml
new file mode 100644
index 0000000..56259ec
--- /dev/null
+++ b/program/fixtures/showinformation.yaml
@@ -0,0 +1,48 @@
+- model: program.showinformation
+ pk:
+ fields:
+ information: Interkulturell
+ abbrev: I
+ slug: interkulturell
+- model: program.showinformation
+ pk:
+ fields:
+ information: Lokalbezug
+ abbrev: L
+ slug: lokalbezug
+- model: program.showinformation
+ pk:
+ fields:
+ information: Minderheiten
+ abbrev: Mi
+ slug: minderheiten
+- model: program.showinformation
+ pk:
+ fields:
+ information: Wiederholung
+ abbrev: W
+ slug: wiederholung
+- model: program.showinformation
+ pk:
+ fields:
+ information: Mehr-/Fremdsprachig
+ abbrev: M
+ slug: mehr-fremdsprachig
+- model: program.showinformation
+ pk:
+ fields:
+ information: Frauenschwerpunkt
+ abbrev: F
+ slug: frauenschwerpunkt
+- model: program.showinformation
+ pk:
+ fields:
+ information: Österreichische Musik
+ abbrev: Ö
+ slug: osterreichische-musik
+- model: program.showinformation
+ pk:
+ fields:
+ information: Sendungsübernahme
+ abbrev: U
+ slug: sendungsubernahme \ No newline at end of file
diff --git a/program/fixtures/showtopics.yaml b/program/fixtures/showtopics.yaml
new file mode 100644
index 0000000..65c4390
--- /dev/null
+++ b/program/fixtures/showtopics.yaml
@@ -0,0 +1,30 @@
+- model: program.showtopic
+ pk:
+ fields:
+ topic: Politik/Gesellschaft
+ abbrev: P
+ slug: politik-gesellschaft
+- model: program.showtopic
+ pk:
+ fields:
+ topic: Natur/Klima/Tiere
+ abbrev: N
+ slug: natur-klima-tiere
+- model: program.showtopic
+ pk:
+ fields:
+ topic: Kultur/Kunst
+ abbrev: K
+ slug: kultur-kunst
+- model: program.showtopic
+ pk:
+ fields:
+ topic: Soziales
+ abbrev: S
+ slug: soziales
+- model: program.showtopic
+ pk:
+ fields:
+ topic: Wissenschaft/Philosophie
+ abbrev: W
+ slug: wissenschaft-philosophie \ No newline at end of file
diff --git a/program/management/__init__.py b/program/management/__init__.py
new file mode 100644
index 0000000..3aa4ca5
--- /dev/null
+++ b/program/management/__init__.py
@@ -0,0 +1,2 @@
+__author__ = 'ers'
+ \ No newline at end of file
diff --git a/program/management/commands/__init__.py b/program/management/commands/__init__.py
new file mode 100644
index 0000000..3aa4ca5
--- /dev/null
+++ b/program/management/commands/__init__.py
@@ -0,0 +1,2 @@
+__author__ = 'ers'
+ \ No newline at end of file
diff --git a/program/models.py b/program/models.py
new file mode 100644
index 0000000..4849fe8
--- /dev/null
+++ b/program/models.py
@@ -0,0 +1,242 @@
+from django.contrib.auth.models import User
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
+from dateutil.rrule import rrule
+
+class BroadcastFormat(models.Model):
+ format = models.CharField(_("Format"), max_length=32)
+ slug = models.SlugField(_("Slug"), max_length=32, unique=True)
+
+ class Meta:
+ ordering = ('format',)
+ verbose_name = _("Broadcast format")
+ verbose_name_plural = _("Broadcast formats")
+
+ def __unicode__(self):
+ return u'%s' % self.format
+
+class ShowInformation(models.Model):
+ information = models.CharField(_("Information"), max_length=32)
+ abbrev = models.CharField(_("Abbreviation"), max_length=4, unique=True)
+ slug = models.SlugField(_("Slug"), max_length=32, unique=True)
+
+ class Meta:
+ ordering = ('information',)
+ verbose_name = _("Show information")
+ verbose_name_plural = _("Show information")
+
+ def __unicode__(self):
+ return u'%s' % self.information
+
+class ShowTopic(models.Model):
+ topic = models.CharField(_("Show topic"), max_length=32)
+ abbrev = models.CharField(_("Abbreviation"), max_length=4, unique=True)
+ slug = models.SlugField(_("Slug"), max_length=32, unique=True)
+
+ class Meta:
+ ordering = ('topic',)
+ verbose_name = _("Show topic")
+ verbose_name_plural = _("Show topics")
+
+ def __unicode__(self):
+ return u'%s' % self.topic
+
+class MusicFocus(models.Model):
+ focus = models.CharField(_("Focus"), max_length=32)
+ abbrev = models.CharField(_("Abbreviation"), max_length=4, unique=True)
+ slug = models.SlugField(_("Slug"), max_length=32, unique=True)
+
+ class Meta:
+ ordering = ('focus',)
+ verbose_name = _("Music focus")
+ verbose_name_plural = _("Music focus")
+
+ def __unicode__(self):
+ return u'%s' % self.focus
+
+class Host(models.Model):
+ name = models.CharField(_("Name"), max_length=128)
+ email = models.EmailField(_("E-Mail"), blank=True)
+ website = models.URLField(_("Website"), blank=True)
+
+ class Meta:
+ ordering = ('name',)
+ verbose_name = _("Host")
+ verbose_name_plural = _("Hosts")
+
+ def __unicode__(self):
+ return u'%s' % self.name
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('host-detail', [str(self.id)])
+
+class Show(models.Model):
+ predecessor = models.ForeignKey('self', blank=True, null=True, related_name='successors', verbose_name=_("Predecessor"))
+ hosts = models.ManyToManyField(Host, blank=True, null=True, related_name='shows', verbose_name=_("Hosts"))
+ owners = models.ManyToManyField(User, blank=True, null=True, related_name='shows', verbose_name=_("Owners"))
+ broadcast_format = models.ForeignKey(BroadcastFormat, related_name='shows', verbose_name=_("Broadcast format"))
+ show_information = models.ManyToManyField(ShowInformation, blank=True, null=True, related_name='shows', verbose_name=_("Show information"))
+ show_topic = models.ManyToManyField(ShowTopic, blank=True, null=True, related_name='shows', verbose_name=_("Show topic"))
+ music_focus = models.ManyToManyField(MusicFocus, blank=True, null=True, related_name='shows', verbose_name=_("Music focus"))
+ name = models.CharField(_("Name"), max_length=256)
+ slug = models.CharField(_("Slug"), max_length=256, unique=True)
+ image = models.ImageField(_("Image"), blank=True, null=True, upload_to='show_images')
+ short_description = models.CharField(_("Short description"), max_length=64)
+ description = models.TextField(_("Description"))
+ email = models.EmailField(_("E-Mail"), blank=True, null=True)
+ website = models.URLField(_("Website"), blank=True, null=True)
+ cba_series_id = models.IntegerField(_("CBA series ID"), blank=True, null=True)
+ created = models.DateTimeField(auto_now_add=True, editable=False)
+ last_updated = models.DateTimeField(auto_now=True, editable=False)
+
+ class Meta:
+ ordering = ('slug',)
+ verbose_name = _("Show")
+ verbose_name_plural = _("Shows")
+
+ def __unicode__(self):
+ return u'%s' % self.name
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('show-detail', [self.slug])
+
+class RRule(models.Model):
+ FREQ_CHOICES = (
+ (1, _("Monthly")),
+ (2, _("Weekly")),
+ (3, _("Daily")),
+ )
+ BYSETPOS_CHOICES = (
+ (1, _("First")),
+ (2, _("Second")),
+ (3, _("Third")),
+ (4, _("Fourth")),
+ (5, _("Fifth")),
+ (-1, _("Last")),
+ )
+ name = models.CharField(_("Name"), max_length=32, unique=True)
+ freq = models.IntegerField(_("Frequency"), choices=FREQ_CHOICES)
+ interval = models.IntegerField(_("Interval"), default=1)
+ bysetpos = models.IntegerField(_("Set position"), blank=True, choices=BYSETPOS_CHOICES, null=True)
+ count = models.IntegerField(_("Count"), blank=True, null=True)
+
+ class Meta:
+ ordering = ('-freq', 'interval', 'bysetpos')
+ verbose_name = _("Recurrence rule")
+ verbose_name_plural = _("Recurrence rules")
+
+ def __unicode__(self):
+ return u'%s' % self.name
+
+class ProgramSlot(models.Model):
+ BYWEEKDAY_CHOICES = (
+ (0, _("Monday")),
+ (1, _("Tuesday")),
+ (2, _("Wednesday")),
+ (3, _("Thursday")),
+ (4, _("Friday")),
+ (5, _("Saturday")),
+ (6, _("Sunday")),
+ )
+ rrule = models.ForeignKey(RRule, related_name='program_slots', verbose_name=_("Recurrence rule"))
+ byweekday = models.IntegerField(_("Weekday"), choices=BYWEEKDAY_CHOICES)
+ show = models.ForeignKey(Show, related_name='program_slots', verbose_name=_("Show"))
+ dstart = models.DateField(_("First date"))
+ tstart = models.TimeField(_("Start time"))
+ tend = models.TimeField(_("End time"))
+ until = models.DateField(_("Last date"))
+ is_repetition = models.BooleanField(_("Is repetition"), default=False)
+ created = models.DateTimeField(auto_now_add=True, editable=False)
+ last_updated = models.DateTimeField(auto_now=True, editable=False)
+
+ class Meta:
+ ordering = ('dstart', 'tstart')
+ unique_together = ('rrule', 'byweekday', 'dstart', 'tstart')
+ verbose_name = _("Program slot")
+ verbose_name_plural = _("Program slots")
+
+ def __unicode__(self):
+ weekday = self.BYWEEKDAY_CHOICES[self.byweekday][1]
+ tend = self.tend.strftime('%H:%M')
+ dstart = self.dstart.strftime('%d. %b %Y')
+ tstart = self.tstart.strftime('%H:%M')
+ until = self.until.strftime('%d. %b %Y')
+
+ return u'%s, %s, %s - %s, %s - %s' % (self.rrule, weekday, tstart, tend, dstart, until)
+
+ def save(self, *args, **kwargs):
+ if not self.pk:
+ super(ProgramSlot, self).save(*args, **kwargs)
+
+ if self.tend < self.tstart:
+ byweekday = self.byweekday + 1 if self.byweekday < 6 else 0
+ else:
+ byweekday = self.byweekday
+
+ starts = list(rrule(freq=self.rrule.freq,
+ dtstart=datetime.combine(self.dstart, self.tstart),
+ interval=self.rrule.interval,
+ until=self.until+relativedelta(days=+1),
+ bysetpos=self.rrule.bysetpos,
+ byweekday=self.byweekday))
+ ends = list(rrule(freq=self.rrule.freq,
+ dtstart=datetime.combine(self.dstart, self.tend),
+ interval=self.rrule.interval,
+ until=self.until+relativedelta(days=+1),
+ bysetpos=self.rrule.bysetpos,
+ byweekday=byweekday))
+
+ for k in range(len(starts)):
+ time_slot = TimeSlot(program_slot=self, start=starts[k], end=ends[k])
+ time_slot.save()
+
+class TimeSlot(models.Model):
+ program_slot = models.ForeignKey(ProgramSlot, related_name='time_slots', verbose_name=_("Program slot"))
+ start = models.DateTimeField(_("Start time"))
+ end = models.DateTimeField(_("End time"))
+
+ class Meta:
+ ordering = ('start', 'end')
+ verbose_name = _("Time slot")
+ verbose_name_plural = _("Time slots")
+
+ def __unicode__(self):
+ start = self.start.strftime('%d. %b %Y %H:%M')
+ end = self.end.strftime('%H:%M')
+
+ return u'%s: %s - %s' % (self.show(), start, end)
+
+ def show(self):
+ return self.program_slot.show
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('timeslot-detail', [self.id])
+
+class Note(models.Model):
+ STATUS_CHOICES = (
+ (0, _("Cancellation")),
+ (1, _("Recommendation")),
+ (2, _("Repetition")),
+ )
+ time_slot = models.OneToOneField(TimeSlot, verbose_name=_("Time slot"))
+ owner = models.ForeignKey(User, related_name='notes', verbose_name=_("Owner"))
+ title = models.CharField(_("Title"), max_length=128)
+ content = models.TextField(_("Content"))
+ status = models.IntegerField(_("Status"), choices=STATUS_CHOICES, default=1)
+ cba_entry_id = models.IntegerField(_("CBA entry ID"), blank=True, null=True)
+ created = models.DateTimeField(auto_now_add=True, editable=False)
+ last_updated = models.DateTimeField(auto_now=True, editable=False)
+
+ class Meta:
+ ordering = ('time_slot',)
+ verbose_name = _("Note")
+ verbose_name_plural = _("Notes")
+
+ def __unicode__(self):
+ return u'%s - %s' % (self.title, self.time_slot) \ No newline at end of file
diff --git a/program/tests.py b/program/tests.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/program/tests.py
diff --git a/program/urls.py b/program/urls.py
new file mode 100644
index 0000000..850fbdd
--- /dev/null
+++ b/program/urls.py
@@ -0,0 +1,14 @@
+from django.conf.urls.defaults import *
+from django.views.generic.detail import DetailView
+from django.views.generic.list import ListView
+
+from models import Host, Show, TimeSlot
+from views import ShowListView
+
+urlpatterns = patterns('',
+ url('^hosts/$', ListView.as_view(model=Host,context_object_name='host_list')),
+ url('^host/(?P<pk>\d+)/$', DetailView.as_view(model=Host), name='host-detail'),
+ url('^shows/$', ShowListView.as_view(model=Show)),
+ url('^show/(?P<slug>[\w-]+)/$', DetailView.as_view(model=Show), name='show-detail'),
+ url('^timeslot/(?P<pk>\d+)/$', DetailView.as_view(model=TimeSlot, context_object_name='timeslot'), name='timeslot-detail'),
+) \ No newline at end of file
diff --git a/program/views.py b/program/views.py
new file mode 100644
index 0000000..c6974b9
--- /dev/null
+++ b/program/views.py
@@ -0,0 +1,17 @@
+from django.views.generic.list import ListView
+
+from models import BroadcastFormat, MusicFocus, Show, ShowInformation, ShowTopic
+
+class ShowListView(ListView):
+ context_object_name = 'show_list'
+ model = Show
+
+ def get_context_data(self, **kwargs):
+ context = super(ShowListView, self).get_context_data(**kwargs)
+
+ context['broadcast_format_list'] = BroadcastFormat.objects.all()
+ context['music_focus_list'] = MusicFocus.objects.all()
+ context['show_information_list'] = ShowInformation.objects.all()
+ context['show_topic_list'] = ShowTopic.objects.all()
+
+ return context \ No newline at end of file
diff --git a/settings.py b/settings.py
new file mode 100644
index 0000000..3c6cf08
--- /dev/null
+++ b/settings.py
@@ -0,0 +1,94 @@
+# Django settings for helsinki project.
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+ # ('Your Name', 'your_email@example.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'helsinki.data',
+ }
+}
+
+TIME_ZONE = 'Europe/Vienna'
+
+LANGUAGE_CODE = 'de'
+
+SITE_ID = 1
+
+USE_I18N = True
+
+USE_L10N = True
+
+MEDIA_ROOT = ''
+
+MEDIA_URL = ''
+
+STATIC_ROOT = ''
+
+STATIC_URL = '/static/'
+
+ADMIN_MEDIA_PREFIX = '/static/admin/'
+
+STATICFILES_DIRS = ()
+
+STATICFILES_FINDERS = (
+ 'django.contrib.staticfiles.finders.FileSystemFinder',
+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
+)
+
+SECRET_KEY = 'oepk-$!=)c)7+y%cdz-x46_h5bp!o-*9%dv!(sf=3r4zfqk_(t'
+
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+# 'django.template.loaders.eggs.Loader',
+)
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+)
+
+ROOT_URLCONF = 'helsinki.urls'
+
+TEMPLATE_DIRS = ('templates',)
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'django.contrib.admin',
+ 'helsinki.program',
+)
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ 'handlers': {
+ 'mail_admins': {
+ 'level': 'ERROR',
+ 'class': 'django.utils.log.AdminEmailHandler'
+ }
+ },
+ 'loggers': {
+ 'django.request':{
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': True,
+ },
+ }
+}
diff --git a/templates/404.html b/templates/404.html
new file mode 100644
index 0000000..6281ba0
--- /dev/null
+++ b/templates/404.html
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+
+{% block title %}Seite nicht gefunden{% endblock %}
+
+{% block content %}
+ <p>Es tut uns leid, aber die angeforderte Seite konnte nicht gefunden werden.</p>
+{% endblock %} \ No newline at end of file
diff --git a/templates/500.html b/templates/500.html
new file mode 100644
index 0000000..98074ab
--- /dev/null
+++ b/templates/500.html
@@ -0,0 +1,11 @@
+{% extends "base.html" %}
+
+{% block title %}Serverfehler{% endblock %}
+
+{% block content %}
+ <p>
+ Ein Fehler ist aufgetreten.
+ Dieser Fehler wurde an die Serververwalter per E-Mail gemeldet und sollte in Kürze behoben sein.
+ Vielen Dank für Ihr Verständnis.
+ </p>
+{% endblock %} \ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..2ed539e
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,11 @@
+<html>
+
+<head>
+ <title>{% block title %}{% endblock %}</title>
+</head>
+
+<body>
+{% block content %}{% endblock %}
+</body>
+
+</html> \ No newline at end of file
diff --git a/templates/program/host_detail.html b/templates/program/host_detail.html
new file mode 100644
index 0000000..a632a20
--- /dev/null
+++ b/templates/program/host_detail.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+ <title>Host detail: {{ host.name }}</title>
+</head>
+<body>
+
+<div id="host-detail">
+ {{ host.name }}
+ {{ host.email }}
+ {{ host.website }}
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/templates/program/host_list.html b/templates/program/host_list.html
new file mode 100644
index 0000000..fb19e47
--- /dev/null
+++ b/templates/program/host_list.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+ <title>Host list</title>
+</head>
+<body>
+
+<div id="host-list">
+ {% for host in host_list %}
+ <div class="host">
+ <a href="{% url host-detail host.id %}">{{ host.name }}</a>
+ </div>
+ {% endfor %}
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/templates/program/show_detail.html b/templates/program/show_detail.html
new file mode 100644
index 0000000..4de24c5
--- /dev/null
+++ b/templates/program/show_detail.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+ <title>Show detail: {{ show.name }}</title>
+</head>
+<body>
+
+<div id="calendar"></div>
+
+<div id="show-detail">
+ <div id="name">{{ show.name }}</div>
+
+ <div id="abbrevs">
+ {% for topic in show.show_topic.all %}
+ <span class="topic-abbrev">{{ topic.abbrev }}</span>
+ {% endfor %}
+ {% for information in show.show_information.all %}
+ <span class="information-abbrev">{{ information.abbrev }}</span>
+ {% endfor %}
+ {% for focus in show.music_focus.all %}
+ <span class="focus-abbrev">{{ focus.abbrev }}</span>
+ {% endfor %}
+ <span class="broadcast-format-abbrev">{{ show.broadcast_format.abbrev }}</span>
+ </div>
+
+ <div id="program-slots">
+ {% for slot in show.program_slots.all %}
+ <div class="program-slot">{{ slot }}</div>
+ {% endfor %}
+ </div>
+
+ <div id="broadcast-format">{{ show.broadcast_format.format }}</div>
+
+ <div id="hosts">
+ {% for host in show.hosts.all %}
+ <div class="host">{{ host }}</div>
+ {% endfor %}
+ </div>
+
+ <div id="short-description">{{ show.short_description }}</div>
+ <div id="description">{{ show.description }}</div>
+ {% if show.email %}
+ <div id="email"><a href="mailto:{{ show.email }}">{{ show.email }}</a></div>
+ {% endif %}
+ {% if show.website %}
+ <div id="website"><a href="{{ show.website }}">{{ show.website }}</a></div>
+ {% endif %}
+ {% if show.cba_series_id %}
+ <div id="cba-series-id"><a href="http://cba.fro.at/series/{{ show.cba_series_id }}">CBA</a></div>
+ {% endif %}
+</div>
+
+</body>
+
+</html> \ No newline at end of file
diff --git a/templates/program/show_list.html b/templates/program/show_list.html
new file mode 100644
index 0000000..09bfa04
--- /dev/null
+++ b/templates/program/show_list.html
@@ -0,0 +1,76 @@
+<html>
+<head>
+ <title>Show list</title>
+</head>
+<body>
+
+<div id="show-topic-list">
+ {% for topic in show_topic_list %}
+ <div class="show-topic">
+ <span class="abbrev">{{ topic.abbrev }}</span>
+ <span class="topic">{{ topic }}</span>
+ </div>
+ {% endfor %}
+</div>
+
+<div id="show-information-list">
+ {% for information in show_information_list %}
+ <div class="show-information">
+ <span class="abbrev">{{ information.abbrev }}</span>
+ <span class="information">{{ information }}</span>
+ </div>
+ {% endfor %}
+</div>
+
+<div id="music-focus-list">
+ {% for focus in music_focus_list %}
+ <div class="music-focus">
+ <span class="abbrev">{{ focus.abbrev }}</span>
+ <span class="focus">{{ focus }}</span>
+ </div>
+ {% endfor %}
+</div>
+
+<div id="show-list">
+ {% for show in show_list %}
+ <div class="show">
+ <div class="abbrevs">
+ {% for topic in show.show_topic.all %}
+ <span class="topic-abbrev">{{ topic.abbrev }}</span>
+ {% endfor %}
+
+ {% for information in show.show_information.all %}
+ <span class="information-abbrev">{{ information.abbrev }}</span>
+ {% endfor %}
+
+ {% for focus in show.music_focus.all %}
+ <span class="focus-abbrev">{{ focus.abbrev }}</span>
+ {% endfor %}
+
+ <span class="broadcast-format-abbrev">{{ show.broadcast_format.abbrev }}</span>
+ </div>
+ <div class="name">
+ <a href="{% url show-detail show.slug %} ">{{ show.name }}</a>
+ </div>
+ <div class="program-slots">
+ {% for slot in show.program_slots.all %}
+ <div class="program-slot">{{ slot }}</div>
+ {% endfor %}
+ </div>
+ <div class="short-description">
+ {{ show.short_description }}
+ </div>
+ </div>
+ {% endfor %}
+</div>
+
+<div id="broadcast-format-list">
+ {% for format in broadcast_format_list %}
+ <div class="broadcast-format">
+ {{ format }}
+ </div>
+ {% endfor %}
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/templates/program/timeslot_detail.html b/templates/program/timeslot_detail.html
new file mode 100644
index 0000000..d589f0e
--- /dev/null
+++ b/templates/program/timeslot_detail.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+ <title>Timeslot detail: {{ timeslot }}</title>
+</head>
+<body>
+
+<div id="calendar"></div>
+
+<div id="timeslot-detail">
+ <div id="name">{{ timeslot.show.name }}</div>
+
+ <div id="abbrevs">
+ {% for topic in timeslot.show.show_topic.all %}
+ <span class="topic-abbrev">{{ topic.abbrev }}</span>
+ {% endfor %}
+ {% for information in timeslot.show.show_information.all %}
+ <span class="information-abbrev">{{ information.abbrev }}</span>
+ {% endfor %}
+ {% for focus in timeslot.show.music_focus.all %}
+ <span class="focus-abbrev">{{ focus.abbrev }}</span>
+ {% endfor %}
+ <span class="broadcast-format-abbrev">{{ timeslot.show.broadcast_format.abbrev }}</span>
+ </div>
+
+ <div id="program-slots">
+ {% for slot in timeslot.show.program_slots.all %}
+ <div class="program-slot">{{ slot }}</div>
+ {% endfor %}
+ </div>
+
+ <div id="broadcast-format">{{ timeslot.show.broadcast_format.format }}</div>
+
+ <div id="hosts">
+ {% for host in timeslot.show.hosts.all %}
+ <div class="host">{{ host }}</div>
+ {% endfor %}
+ </div>
+
+ <div id="short-description">{{ timeslot.show.short_description }}</div>
+ <div id="description">{{ timeslot.show.description }}</div>
+
+ <div id="note">
+ {% if timeslot.note %}
+ <div class="note">
+ <div class="title">{{ timeslot.note.title }}</div>
+ <div class="content">{{ timeslot.note.content }}</div>
+ </div>
+ {% endif %}
+ </div>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/urls.py b/urls.py
new file mode 100644
index 0000000..db535ce
--- /dev/null
+++ b/urls.py
@@ -0,0 +1,9 @@
+from django.conf.urls.defaults import *
+from django.contrib import admin
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ (r'^admin/', include(admin.site.urls)),
+ (r'^program/', include('helsinki.program.urls')),
+)