diff options
-rw-r--r-- | TODO | 0 | ||||
-rw-r--r-- | TODO.md | 5 | ||||
-rw-r--r-- | nop/urls.py | 2 | ||||
-rw-r--r-- | program/admin.py | 3 | ||||
-rw-r--r-- | program/management/commands/addnote.py | 11 | ||||
-rw-r--r-- | program/management/commands/cleanup_defaultshow.py | 5 | ||||
-rw-r--r-- | program/management/commands/createuser.py | 1 | ||||
-rw-r--r-- | program/management/commands/deleteuser.py | 3 | ||||
-rw-r--r-- | program/management/commands/importhosts.py | 1 | ||||
-rw-r--r-- | program/management/commands/importnotes.py | 9 | ||||
-rw-r--r-- | program/management/commands/importprogramslots.py | 8 | ||||
-rw-r--r-- | program/management/commands/importshows.py | 10 | ||||
-rw-r--r-- | program/migrations/0006_note_remove_cba_entry_id.py | 18 | ||||
-rw-r--r-- | program/migrations/0007_show_remove_cba_series_id.py | 18 | ||||
-rw-r--r-- | program/models.py | 2 | ||||
-rw-r--r-- | program/templatetags/content_boxes.py | 5 | ||||
-rw-r--r-- | program/templatetags/timeslots.py | 4 | ||||
-rw-r--r-- | program/urls.py | 6 | ||||
-rw-r--r-- | pv/templates/404.html | 7 | ||||
-rw-r--r-- | pv/templates/500.html | 11 | ||||
-rw-r--r-- | pv/templates/base.html | 11 | ||||
-rw-r--r-- | pv/urls.py | 11 | ||||
-rw-r--r-- | requirements.txt | 2 |
23 files changed, 88 insertions, 65 deletions
@@ -0,0 +1,5 @@ +- [ ] list notes of predecessor, if available, on show detail page +- [ ] list notes of successor, if available to show detail page +- [ ] add management command to automatically renew program slots +- [ ] add jingle field (File) to Show model +- [ ] customize the admin interface for program slot diff --git a/nop/urls.py b/nop/urls.py index 3cc97a4..392d633 100644 --- a/nop/urls.py +++ b/nop/urls.py @@ -10,4 +10,4 @@ urlpatterns = patterns('', url(r'^/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<hour>\d{1,2})/(?P<minute>\d{1,2})/?$', get), url(r'^/?$', nop_form), url(r'^/static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': NOP_SITE_MEDIA}), -) + ) diff --git a/program/admin.py b/program/admin.py index e6c331a..1323697 100644 --- a/program/admin.py +++ b/program/admin.py @@ -58,11 +58,13 @@ class NoteAdmin(admin.ModelAdmin): class TimeSlotInline(admin.TabularInline): model = TimeSlot + ordering = ('-end',) class ProgramSlotAdmin(admin.ModelAdmin): actions = ('renew',) inlines = (TimeSlotInline,) + fields = (('rrule', 'byweekday'), ('dstart', 'tstart', 'tend'), 'until', 'is_repetition', 'automation_id') list_display = ('show', 'byweekday', 'rrule', 'tstart', 'tend', 'until') list_filter = ('byweekday', 'rrule', 'is_repetition', 'is_active') ordering = ('byweekday', 'dstart') @@ -83,6 +85,7 @@ class ProgramSlotAdmin(admin.ModelAdmin): class ProgramSlotInline(admin.TabularInline): model = ProgramSlot + ordering = ('-until',) class ShowAdmin(admin.ModelAdmin): diff --git a/program/management/commands/addnote.py b/program/management/commands/addnote.py index 01d891e..5c0147e 100644 --- a/program/management/commands/addnote.py +++ b/program/management/commands/addnote.py @@ -1,4 +1,3 @@ -from django.contrib.auth.models import User from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ValidationError @@ -7,6 +6,7 @@ import sys from program.models import Show, TimeSlot, Note + class Command(BaseCommand): help = 'adds a note to a timeslot' args = '<show_id> <start_date> <status> [index]' @@ -40,11 +40,13 @@ class Command(BaseCommand): timeslot = TimeSlot.objects.get(show=show, start__year=year, start__month=month, start__day=day) except TimeSlot.DoesNotExist as dne: raise CommandError(dne) - except TimeSlot.MultipleObjectsReturned as mor: + except TimeSlot.MultipleObjectsReturned: if not index: - raise CommandError('you must provide the show_id, start_date, status index') + raise CommandError('you must provide the show_id, start_date, status index') try: - timeslot = TimeSlot.objects.filter(show=show, start__year=year, start__month=month, start__day=day).order_by('start')[int(index)] + timeslot = \ + TimeSlot.objects.filter(show=show, start__year=year, start__month=month, start__day=day).order_by( + 'start')[int(index)] except IndexError as ie: raise CommandError(ie) @@ -63,4 +65,3 @@ class Command(BaseCommand): else: note.save() print 'added note "%s" to "%s"' % (title, timeslot) - diff --git a/program/management/commands/cleanup_defaultshow.py b/program/management/commands/cleanup_defaultshow.py index 2f6ccca..98d3f98 100644 --- a/program/management/commands/cleanup_defaultshow.py +++ b/program/management/commands/cleanup_defaultshow.py @@ -3,10 +3,12 @@ from django.db import transaction from program.models import Show, TimeSlot, ProgramSlot + class Command(NoArgsCommand): + help = 'removes default shows without note' + @transaction.commit_manually def handle_noargs(self, **options): - help = 'removes default shows without note' default_show = Show.objects.get(pk=1) try: @@ -18,4 +20,3 @@ class Command(NoArgsCommand): transaction.rollback() else: transaction.commit() - diff --git a/program/management/commands/createuser.py b/program/management/commands/createuser.py index a356bb3..a78c101 100644 --- a/program/management/commands/createuser.py +++ b/program/management/commands/createuser.py @@ -3,6 +3,7 @@ from django.core.management.base import BaseCommand, CommandError from optparse import make_option + class Command(BaseCommand): help = 'creates an user' option_list = BaseCommand.option_list + ( diff --git a/program/management/commands/deleteuser.py b/program/management/commands/deleteuser.py index 27ce61e..db2cb60 100644 --- a/program/management/commands/deleteuser.py +++ b/program/management/commands/deleteuser.py @@ -3,6 +3,7 @@ from django.core.management.base import BaseCommand, CommandError from optparse import make_option + class Command(BaseCommand): help = 'deletes an user' option_list = BaseCommand.option_list + ( @@ -19,4 +20,4 @@ class Command(BaseCommand): except User.DoesNotExist: raise 'user does not exist.' else: - print 'user deleted succesfuly.'
\ No newline at end of file + print 'user deleted succesfuly.' diff --git a/program/management/commands/importhosts.py b/program/management/commands/importhosts.py index 1ecabef..31f4a3f 100644 --- a/program/management/commands/importhosts.py +++ b/program/management/commands/importhosts.py @@ -8,6 +8,7 @@ USER = 'helsinki' PASSWD = 'helsinki' DB = 'helsinki' + class Command(NoArgsCommand): help = 'Import hosts from current program' diff --git a/program/management/commands/importnotes.py b/program/management/commands/importnotes.py index 287dcef..0a1ab0f 100644 --- a/program/management/commands/importnotes.py +++ b/program/management/commands/importnotes.py @@ -1,7 +1,6 @@ -from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, ValidationError from django.core.management.base import NoArgsCommand -from django.utils.html import clean_html, strip_tags +from django.utils.html import strip_tags import MySQLdb @@ -11,6 +10,7 @@ USER = 'helsinki' PASSWD = 'helsinki' DB = 'helsinki' + class Command(NoArgsCommand): help = 'Import notes from current program' @@ -26,7 +26,7 @@ WHERE n.sendung_id in (SELECT id FROM sendungen WHERE letzter_termin > current_d for ntitel, datum, stitel, notiz in cursor.fetchall(): ntitel = strip_tags(ntitel) if ntitel else strip_tags(stitel) stitel = strip_tags(stitel) - notiz = clean_html(notiz) + notiz = strip_tags(notiz) if stitel.endswith('(Wiederholung)'): stitel = stitel[:-15] @@ -39,7 +39,8 @@ WHERE n.sendung_id in (SELECT id FROM sendungen WHERE letzter_termin > current_d print 'show with name "%s" not found' % stitel else: try: - timeslot = TimeSlot.objects.get(programslot__show=show, start__year=year, start__month=month, start__day=day) + timeslot = TimeSlot.objects.get(programslot__show=show, start__year=year, start__month=month, + start__day=day) except ObjectDoesNotExist: print 'no timeslot found for sendung "%s" and datum "%s"' % (stitel, datum) except MultipleObjectsReturned: diff --git a/program/management/commands/importprogramslots.py b/program/management/commands/importprogramslots.py index ce4f60e..b527f53 100644 --- a/program/management/commands/importprogramslots.py +++ b/program/management/commands/importprogramslots.py @@ -18,6 +18,7 @@ RRULES = { 28: RRule.objects.get(pk=5) } + class Command(NoArgsCommand): help = 'Import programslots from the current program' @@ -49,8 +50,8 @@ WHERE letzter_termin > current_date AND titel NOT LIKE 'Musikprogramm' AND titel except ObjectDoesNotExist: print 'show with name "%s" not found' % titel else: - programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, tstart=tstart, - tend=tend, until=letzter_termin) + programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, + tstart=tstart, tend=tend, until=letzter_termin) try: programslot.save() counter += 1 @@ -81,7 +82,8 @@ WHERE letzter_termin > current_date AND titel LIKE '%%(Wiederholung)'""") except ObjectDoesNotExist: print 'show with name "%s" not found' % titel else: - programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, tstart=tstart, tend=tend, until=letzter_termin, is_repetition=True) + programslot = ProgramSlot(rrule=rrule, byweekday=termin, show=show, dstart=erster_termin, + tstart=tstart, tend=tend, until=letzter_termin, is_repetition=True) try: programslot.save() counter += 1 diff --git a/program/management/commands/importshows.py b/program/management/commands/importshows.py index d5fdee7..f1353b8 100644 --- a/program/management/commands/importshows.py +++ b/program/management/commands/importshows.py @@ -1,7 +1,7 @@ from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.core.management.base import NoArgsCommand from django.template.defaultfilters import slugify -from django.utils.html import clean_html, strip_tags +from django.utils.html import strip_tags import MySQLdb @@ -13,9 +13,10 @@ DB = 'helsinki' TALK = BroadcastFormat.objects.get(pk=1) + class Command(NoArgsCommand): help = 'Import shows from the current program' - + def handle_noargs(self, **options): connection = MySQLdb.connect(user=USER, passwd=PASSWD, db=DB) cursor = connection.cursor() @@ -29,7 +30,7 @@ ORDER BY titel, beginn, ende""") for titel, beschreibung, web, macher in cursor.fetchall(): titel = strip_tags(titel) - beschreibung = clean_html(beschreibung) + beschreibung = strip_tags(beschreibung) slug = slugify(titel) @@ -50,7 +51,8 @@ ORDER BY titel, beginn, ende""") show = Show.objects.get(name=titel) print 'sendung "%s" already imported as show "%s"' % (titel, show) except ObjectDoesNotExist: - show = Show(broadcastformat=TALK, name=titel, slug=slug, short_description='FIXME', description=beschreibung) + show = Show(broadcastformat=TALK, name=titel, slug=slug, short_description='FIXME', + description=beschreibung) try: show.save() counter += 1 diff --git a/program/migrations/0006_note_remove_cba_entry_id.py b/program/migrations/0006_note_remove_cba_entry_id.py new file mode 100644 index 0000000..d04be57 --- /dev/null +++ b/program/migrations/0006_note_remove_cba_entry_id.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0005_programslot_is_active'), + ] + + operations = [ + migrations.RemoveField( + model_name='note', + name='cba_entry_id', + ), + ] diff --git a/program/migrations/0007_show_remove_cba_series_id.py b/program/migrations/0007_show_remove_cba_series_id.py new file mode 100644 index 0000000..1173b51 --- /dev/null +++ b/program/migrations/0007_show_remove_cba_series_id.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0006_note_remove_cba_entry_id'), + ] + + operations = [ + migrations.RemoveField( + model_name='show', + name='cba_series_id', + ), + ] diff --git a/program/models.py b/program/models.py index c3bc468..7f9d665 100644 --- a/program/models.py +++ b/program/models.py @@ -244,7 +244,6 @@ class Show(models.Model): email = models.EmailField(_("E-Mail"), blank=True, null=True) website = models.URLField(_("Website"), blank=True, null=True) is_active = models.BooleanField(_("Is active"), default=True, editable=False) - cba_series_id = models.IntegerField(_("CBA series ID"), blank=True, null=True) automation_id = models.IntegerField(_("Automation ID"), blank=True, null=True, choices=get_automation_id_choices()) created = models.DateTimeField(auto_now_add=True, editable=False) last_updated = models.DateTimeField(auto_now=True, editable=False) @@ -489,7 +488,6 @@ class Note(models.Model): title = models.CharField(_("Title"), max_length=128) content = tinymce_models.HTMLField(_("Content")) status = models.IntegerField(_("Status"), choices=STATUS_CHOICES, default=1) - cba_entry_id = models.IntegerField(_("CBA entry ID"), blank=True, null=True) start = models.DateTimeField(editable=False) show = models.ForeignKey(Show, editable=False, related_name='notes') created = models.DateTimeField(auto_now_add=True, editable=False) diff --git a/program/templatetags/content_boxes.py b/program/templatetags/content_boxes.py index 7f176c6..2d1745e 100644 --- a/program/templatetags/content_boxes.py +++ b/program/templatetags/content_boxes.py @@ -1,10 +1,9 @@ -# http://docs.djangoproject.com/en/1.2/howto/custom-template-tags/ - from django import template -register = template.Library() from program.models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic +register = template.Library() + @register.inclusion_tag('boxes/broadcastformat.html') def broadcastformat(): diff --git a/program/templatetags/timeslots.py b/program/templatetags/timeslots.py index c2c44b5..08e45b1 100644 --- a/program/templatetags/timeslots.py +++ b/program/templatetags/timeslots.py @@ -1,9 +1,9 @@ from django import template -register = template.Library() - from datetime import datetime, time, timedelta +register = template.Library() + @register.simple_tag def duration(start, end): diff --git a/program/urls.py b/program/urls.py index 18625a4..a3badf3 100644 --- a/program/urls.py +++ b/program/urls.py @@ -8,7 +8,6 @@ import os PROGRAM_SITE_MEDIA = os.path.join(os.path.dirname(__file__), '../site_media') - urlpatterns = patterns('', url(r'^today/?$', views.DayScheduleView.as_view()), url(r'^week/?$', views.WeekScheduleView.as_view()), @@ -25,5 +24,6 @@ urlpatterns = patterns('', url(r'^styles.css$', views.StylesView.as_view()) ) if settings.DEBUG: - urlpatterns += patterns('', - url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': PROGRAM_SITE_MEDIA})) + urlpatterns += \ + patterns('', + url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': PROGRAM_SITE_MEDIA})) diff --git a/pv/templates/404.html b/pv/templates/404.html deleted file mode 100644 index 6281ba0..0000000 --- a/pv/templates/404.html +++ /dev/null @@ -1,7 +0,0 @@ -{% 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/pv/templates/500.html b/pv/templates/500.html deleted file mode 100644 index 98074ab..0000000 --- a/pv/templates/500.html +++ /dev/null @@ -1,11 +0,0 @@ -{% 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/pv/templates/base.html b/pv/templates/base.html deleted file mode 100644 index 2ed539e..0000000 --- a/pv/templates/base.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> - -<head> - <title>{% block title %}{% endblock %}</title> -</head> - -<body> -{% block content %}{% endblock %} -</body> - -</html>
\ No newline at end of file @@ -2,19 +2,20 @@ from django.conf import settings from django.conf.urls import patterns, url, include from django.contrib import admin -admin.autodiscover() - from program.views import json_day_schedule +admin.autodiscover() + urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^program/', include('program.urls')), url(r'^nop', include('nop.urls')), url(r'^tinymce/', include('tinymce.urls')), url(r'^export/day_schedule/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', json_day_schedule) -) + ) if settings.DEBUG: urlpatterns += patterns('', - (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}) -) + (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT}) + ) diff --git a/requirements.txt b/requirements.txt index 7a1f664..b895f65 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django==1.8.12 +Django==1.8.13 MySQL-python==1.2.5 Pillow==3.2.0 PyYAML==3.11 |