From 36d8f7e5604f62bb51dcdb4dee4cc013bd0abda2 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 27 Feb 2011 12:38:02 +0100 Subject: First commit 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 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 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 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\d+)/$', DetailView.as_view(model=Host), name='host-detail'), + url('^shows/$', ShowListView.as_view(model=Show)), + url('^show/(?P[\w-]+)/$', DetailView.as_view(model=Show), name='show-detail'), + url('^timeslot/(?P\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 %} +

Es tut uns leid, aber die angeforderte Seite konnte nicht gefunden werden.

+{% 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 %} +

+ 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. +

+{% 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 @@ + + + + {% block title %}{% endblock %} + + + +{% block content %}{% endblock %} + + + \ 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 @@ + + + Host detail: {{ host.name }} + + + +
+ {{ host.name }} + {{ host.email }} + {{ host.website }} +
+ + \ 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 @@ + + + Host list + + + +
+ {% for host in host_list %} + + {% endfor %} +
+ + \ 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 @@ + + + Show detail: {{ show.name }} + + + +
+ +
+
{{ show.name }}
+ +
+ {% for topic in show.show_topic.all %} + {{ topic.abbrev }} + {% endfor %} + {% for information in show.show_information.all %} + {{ information.abbrev }} + {% endfor %} + {% for focus in show.music_focus.all %} + {{ focus.abbrev }} + {% endfor %} + {{ show.broadcast_format.abbrev }} +
+ +
+ {% for slot in show.program_slots.all %} +
{{ slot }}
+ {% endfor %} +
+ +
{{ show.broadcast_format.format }}
+ +
+ {% for host in show.hosts.all %} +
{{ host }}
+ {% endfor %} +
+ +
{{ show.short_description }}
+
{{ show.description }}
+ {% if show.email %} + + {% endif %} + {% if show.website %} + + {% endif %} + {% if show.cba_series_id %} + + {% endif %} +
+ + + + \ 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 @@ + + + Show list + + + +
+ {% for topic in show_topic_list %} +
+ {{ topic.abbrev }} + {{ topic }} +
+ {% endfor %} +
+ +
+ {% for information in show_information_list %} +
+ {{ information.abbrev }} + {{ information }} +
+ {% endfor %} +
+ +
+ {% for focus in music_focus_list %} +
+ {{ focus.abbrev }} + {{ focus }} +
+ {% endfor %} +
+ +
+ {% for show in show_list %} +
+
+ {% for topic in show.show_topic.all %} + {{ topic.abbrev }} + {% endfor %} + + {% for information in show.show_information.all %} + {{ information.abbrev }} + {% endfor %} + + {% for focus in show.music_focus.all %} + {{ focus.abbrev }} + {% endfor %} + + {{ show.broadcast_format.abbrev }} +
+ +
+ {% for slot in show.program_slots.all %} +
{{ slot }}
+ {% endfor %} +
+
+ {{ show.short_description }} +
+
+ {% endfor %} +
+ +
+ {% for format in broadcast_format_list %} +
+ {{ format }} +
+ {% endfor %} +
+ + + \ 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 @@ + + + Timeslot detail: {{ timeslot }} + + + +
+ +
+
{{ timeslot.show.name }}
+ +
+ {% for topic in timeslot.show.show_topic.all %} + {{ topic.abbrev }} + {% endfor %} + {% for information in timeslot.show.show_information.all %} + {{ information.abbrev }} + {% endfor %} + {% for focus in timeslot.show.music_focus.all %} + {{ focus.abbrev }} + {% endfor %} + {{ timeslot.show.broadcast_format.abbrev }} +
+ +
+ {% for slot in timeslot.show.program_slots.all %} +
{{ slot }}
+ {% endfor %} +
+ +
{{ timeslot.show.broadcast_format.format }}
+ +
+ {% for host in timeslot.show.hosts.all %} +
{{ host }}
+ {% endfor %} +
+ +
{{ timeslot.show.short_description }}
+
{{ timeslot.show.description }}
+ +
+ {% if timeslot.note %} +
+
{{ timeslot.note.title }}
+
{{ timeslot.note.content }}
+
+ {% endif %} +
+
+ + + \ 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')), +) -- cgit v0.10.2