diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-04-07 17:33:39 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-04-07 17:33:39 (GMT) |
commit | 4edb31db07b8f966a8f2ffe4c63e1036c1acca25 (patch) | |
tree | d556b09827a520dfbdf79dcf5dca1d27e1bc5f3f /helsinki/program | |
parent | 8c40f3836613b0d2b0d08d87a5ad9444aac275f9 (diff) |
cherry-picked commits from develop branch.
Diffstat (limited to 'helsinki/program')
-rw-r--r-- | helsinki/program/admin.py | 26 | ||||
-rw-r--r-- | helsinki/program/models.py | 2 | ||||
-rw-r--r-- | helsinki/program/templates/program/current_box.html | 4 | ||||
-rw-r--r-- | helsinki/program/templates/program/day_schedule.html | 2 | ||||
-rw-r--r-- | helsinki/program/templates/program/host_detail.html | 13 | ||||
-rw-r--r-- | helsinki/program/templates/program/host_list.html | 1 | ||||
-rw-r--r-- | helsinki/program/templates/program/recommendations.html | 18 | ||||
-rw-r--r-- | helsinki/program/templates/program/show_detail.html | 4 | ||||
-rw-r--r-- | helsinki/program/templates/program/show_list.html | 93 | ||||
-rw-r--r-- | helsinki/program/templates/program/timeslot_detail.html | 13 | ||||
-rw-r--r-- | helsinki/program/templates/program/week_schedule.html | 28 | ||||
-rw-r--r-- | helsinki/program/urls.py | 10 |
12 files changed, 128 insertions, 86 deletions
diff --git a/helsinki/program/admin.py b/helsinki/program/admin.py index 5a6ce7f..6c64dd3 100644 --- a/helsinki/program/admin.py +++ b/helsinki/program/admin.py @@ -1,5 +1,7 @@ from django.contrib import admin +from datetime import datetime + from models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic, Host, Note, ProgramSlot, Show, TimeSlot class BroadcastFormatAdmin(admin.ModelAdmin): @@ -20,10 +22,32 @@ class ShowTopicAdmin(admin.ModelAdmin): class NoteAdmin(admin.ModelAdmin): date_hierarchy = 'start' - list_display = ('title', 'show', 'status') + list_display = ('title', 'show', 'start', 'status') list_filter = ('status',) ordering = ('timeslot',) + def queryset(self, request): + qs = super(NoteAdmin, self).queryset(request) + + if request.user.is_superuser: + return qs + else: + return qs.filter(owner=request.user) + + def formfield_for_foreignkey(self, db_field, request, **kwargs): + if db_field.name == 'timeslot': + if request.user.is_superuser: + kwargs['queryset'] = TimeSlot.objects.filter(start__gt=datetime.now) + else: + shows = request.user.shows.all() + kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=datetime.now) + + return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) + + def save_model(self, request, obj, form, change): + obj.owner = request.user + obj.save() + class TimeSlotInline(admin.TabularInline): model = TimeSlot diff --git a/helsinki/program/models.py b/helsinki/program/models.py index f6839e2..d792efb 100644 --- a/helsinki/program/models.py +++ b/helsinki/program/models.py @@ -271,7 +271,7 @@ class Note(models.Model): (1, _("Recommendation")), (2, _("Repetition")), ) - timeslot = models.OneToOneField(TimeSlot, limit_choices_to={'start__gte': datetime.now}, verbose_name=_("Time slot")) + timeslot = 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")) diff --git a/helsinki/program/templates/program/current_box.html b/helsinki/program/templates/program/current_box.html index 8220ba4..21713be 100644 --- a/helsinki/program/templates/program/current_box.html +++ b/helsinki/program/templates/program/current_box.html @@ -17,7 +17,9 @@ {% if current.note %} <div class="note-title">{{ current.note.title }}</div> {% else %} - <div class="short-description">{{ current.show.short_description }}</div> + {% if current.show.short_description != 'FIMXE' %} + <div class="short-description">{{ current.show.short_description }}</div> + {% endif %} {% endif %} </div> </dd> diff --git a/helsinki/program/templates/program/day_schedule.html b/helsinki/program/templates/program/day_schedule.html index 6230314..3e7d4bc 100644 --- a/helsinki/program/templates/program/day_schedule.html +++ b/helsinki/program/templates/program/day_schedule.html @@ -42,7 +42,9 @@ {% if timeslot.note %} <div class="note-title">Heute: {{ timeslot.note.title }}</div> {% else %} + {% if timeslot.show.short_description != 'FIXME' %} <div class="short-description">{{ timeslot.show.short_description }}</div> + {% endif %} {% endif %} </div> </div> diff --git a/helsinki/program/templates/program/host_detail.html b/helsinki/program/templates/program/host_detail.html index b780838..eff52d6 100644 --- a/helsinki/program/templates/program/host_detail.html +++ b/helsinki/program/templates/program/host_detail.html @@ -1,18 +1,27 @@ <html> <head> <title>Host detail: {{ host.name }}</title> + <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> <div id="host-detail"> <div id="name">{{ host.name }}</div> + <div id="shows"> + <div id="shows-title">Sendungen</div> + + {% for show in host.shows.all %} + <div class="show {{ show.broadcastformat.slug }}"><a href="{% url show-detail show.slug %}">{{ show }}</a></div> + {% endfor %} + </div> + {% if host.email %} - <div id="email">{{ host.email }}</div> + <div id="email">E-Mail Adresse: <a href="{{ host.email }}">{{ host.email }}</a></div> {% endif %} {% if host.website %} - <div id="website">{{ host.website }}</div> + <div id="website">Website: <a href="{{ host.website }}">{{ host.website }}</a></div> {% endif %} </div> diff --git a/helsinki/program/templates/program/host_list.html b/helsinki/program/templates/program/host_list.html index 365154a..6497d35 100644 --- a/helsinki/program/templates/program/host_list.html +++ b/helsinki/program/templates/program/host_list.html @@ -1,6 +1,7 @@ <html> <head> <title>Host list</title> + <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> diff --git a/helsinki/program/templates/program/recommendations.html b/helsinki/program/templates/program/recommendations.html index aa5866a..a8f5fde 100644 --- a/helsinki/program/templates/program/recommendations.html +++ b/helsinki/program/templates/program/recommendations.html @@ -1,18 +1,20 @@ <html> <head> <title>Recomendations</title> + <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> <div id="recommendations"> -{% for note in recommendations %} - <div class="show"> - <div class="broadcastformat">{{ note.show.broadcastformat }}</div> - <div class="timeslot">{{ note.timeslot.start }}</div> - <div class="show-name"><a href="{% url show-detail note.show.slug %}">{{ note.show.name }}</a></div> - <div class="show-short-description">{{ note.show.short_description }}</div> - <div class="note-title">{{ note.title }}</div> - <div class="note-content">{{ note.content }}</div> +{% for recommendation in recommendations %} + <div class="recommendation"> + <div class="timeslot-start-end">{{ recommendation.timeslot.start|date:"d.m.Y H:i" }} - {{ recommendation.timeslot.end|date:"H:i" }}</div> + <div class="show-name"><a href="{% url show-detail recommendation.show.slug %}">{{ recommendation.show.name }}</a></div> + {% if recommendation.show.short_description != 'FIXME' %} + <div class="show-short-description">{{ recommendation.show.short_description }}</div> + {% endif %} + <div class="note-title"><a href="{% url timeslot-detail recommendation.timeslot.id %}">{{ recommendation.title }}</a></div> + <div class="note-content">{{ recommendation.content|safe}}</div> </div> {% endfor %} </div> diff --git a/helsinki/program/templates/program/show_detail.html b/helsinki/program/templates/program/show_detail.html index 05e678c..9cd2d8e 100644 --- a/helsinki/program/templates/program/show_detail.html +++ b/helsinki/program/templates/program/show_detail.html @@ -39,9 +39,11 @@ {% endfor %} </div> + {% if show.short_description != 'FIXME' %} <div id="short-description">{{ show.short_description }}</div> + {% endif %} - <div id="description">{{ show.description }}</div> + <div id="description">{{ show.description|safe }}</div> {% if show.email %} <div id="email"><a href="mailto:{{ show.email }}">{{ show.email }}</a></div> diff --git a/helsinki/program/templates/program/show_list.html b/helsinki/program/templates/program/show_list.html index 7643087..1f061d0 100644 --- a/helsinki/program/templates/program/show_list.html +++ b/helsinki/program/templates/program/show_list.html @@ -1,72 +1,87 @@ <html> <head> <title>Show list</title> + <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> -<div id="showtopic-list"> -{% for topic in showtopics %} - <div class="showtopic"> - <span class="abbrev">{{ topic.abbrev }}</span> - <span class="topic">{{ topic }}</span> +<div id="filter"> + <div id="filter-title">Filter</div> + + <div id="showtopics"> + <div id="showtopics-title">Thema/Schwerpunkt</div> + {% for topic in showtopics %} + <div class="showtopic"> + <span class="abbrev">{{ topic.abbrev }}</span> + <span class="topic"><a href="?showtopic={{ topic.slug }}">{{ topic }}</a></span> + </div> + {% endfor %} </div> -{% endfor %} -</div> -<div id="showinformation-list"> -{% for information in showinformations %} - <div class="showinformation"> - <span class="abbrev">{{ information.abbrev }}</span> - <span class="information">{{ information }}</span> + <div id="showinformations"> + <div id="showinformations-title"></div> + {% for information in showinformations %} + <div class="showinformation"> + <span class="abbrev">{{ information.abbrev }}</span> + <span class="information"><a href="?showinformation={{ information.slug }}">{{ information }}</a></span> + </div> + {% endfor %} </div> -{% endfor %} -</div> -<div id="musicfocus-list"> -{% for focus in musicfoci %} - <div class="musicfocus"> - <span class="abbrev">{{ focus.abbrev }}</span> - <span class="focus">{{ focus }}</span> + <div id="musicfoci"> + <div id="musicfoci-title">Musiktendenz</div> + {% for focus in musicfoci %} + <div class="musicfocus"> + <span class="abbrev">{{ focus.abbrev }}</span> + <span class="focus"><a href="?musicfocus={{ focus.slug }}">{{ focus }}</a></span> + </div> + {% endfor %} </div> -{% endfor %} </div> -<div id="show-list"> +<div id="shows"> {% for show in shows %} <div class="show"> - <div class="abbrevs"> - {% for topic in show.showtopic.all %} + <div class="abbrevs"> + {% for topic in show.showtopic.all %} <span class="topic-abbrev">{{ topic.abbrev }}</span> - {% endfor %} + {% endfor %} - {% for information in show.showinformation.all %} + {% for information in show.showinformation.all %} <span class="information-abbrev">{{ information.abbrev }}</span> - {% endfor %} + {% endfor %} - {% for focus in show.musicfocus.all %} + {% for focus in show.musicfocus.all %} <span class="focus-abbrev">{{ focus.abbrev }}</span> - {% endfor %} + {% endfor %} <span class="broadcastformat-abbrev">{{ show.broadcastformat.abbrev }}</span> </div> - <div class="name"><a href="{% url show-detail show.slug %} ">{{ show.name }}</a></div> + <div class="details"> + <div class="name"><a href="{% url show-detail show.slug %}">{{ show.name }}</a></div> - <div class="programslots"> - {% for slot in show.programslots.all %} - <div class="programslot">{{ slot }}</div> - {% endfor %} - </div> + <div class="programslots"> + {% for slot in show.programslots.all %} + <div class="programslot">{{ slot }}</div> + {% endfor %} + </div> - <div class="short-description">{{ show.short_description }}</div> + {% if show.short_description != 'FIXME' %} + <div class="short-description">{{ show.short_description }}</div> + {% endif %} + </div> </div> {% endfor %} </div> -<div id="broadcastformat-list"> -{% for format in broadcastformats %} - <div class="broadcastformat">{{ format }}</div> -{% endfor %} +<div id="broadcastformats"> + <div id="broadcastformats-title">Legende</div> + {% for broadcastformat in broadcastformats %} + <div class="{{ broadcastformat.slug }}"> + <a href="?broadcastformat={{ broadcastformat.slug }}">{{ broadcastformat.format }}</a> + </div> + {% endfor %} </div> </body> diff --git a/helsinki/program/templates/program/timeslot_detail.html b/helsinki/program/templates/program/timeslot_detail.html index f445f5d..f8dee29 100644 --- a/helsinki/program/templates/program/timeslot_detail.html +++ b/helsinki/program/templates/program/timeslot_detail.html @@ -1,13 +1,12 @@ <html> <head> <title>Timeslot detail: {{ timeslot }}</title> + <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> -<div id="calendar"></div> - <div id="timeslot-detail"> - <div id="name">{{ timeslot.show.name }}</div> + <div id="show-name">{{ timeslot.show.name }}</div> <div id="abbrevs"> {% for topic in timeslot.show.showtopic.all %} @@ -35,19 +34,21 @@ <div id="hosts"> {% for host in timeslot.show.hosts.all %} - <div class="host">{{ host }}</div> + <div class="host"><a href="{% url host-detail host.id %}">{{ host }}</a></div> {% endfor %} </div> + {% if timeslot.show.short_description != 'FIXME' %} <div id="short-description">{{ timeslot.show.short_description }}</div> + {% endif %} - <div id="description">{{ timeslot.show.description }}</div> + <div id="description">{{ timeslot.show.description|safe }}</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 class="content">{{ timeslot.note.content|safe }}</div> </div> {% endif %} </div> diff --git a/helsinki/program/templates/program/week_schedule.html b/helsinki/program/templates/program/week_schedule.html index 2969d28..f6e8f57 100644 --- a/helsinki/program/templates/program/week_schedule.html +++ b/helsinki/program/templates/program/week_schedule.html @@ -1,38 +1,12 @@ <html> <head> <title>Week schedule</title> + <link href="/site_media/styles/base.css" media="screen" rel="stylesheet" type="text/css" /> </head> <body> <div id="week-schedule"> - <div id="time"> - <div class="1hour">06:00</div> - <div class="1hour">07:00</div> - <div class="1hour">08:00</div> - <div class="1hour">09:00</div> - <div class="1hour">10:00</div> - <div class="1hour">11:00</div> - <div class="1hour">12:00</div> - <div class="1hour">13:00</div> - <div class="1hour">14:00</div> - <div class="1hour">15:00</div> - <div class="1hour">16:00</div> - <div class="1hour">17:00</div> - <div class="1hour">18:00</div> - <div class="1hour">19:00</div> - <div class="1hour">20:00</div> - <div class="1hour">21:00</div> - <div class="1hour">22:00</div> - <div class="1hour">23:00</div> - <div class="1hour">00:00</div> - <div class="1hour">01:00</div> - <div class="1hour">02:00</div> - <div class="1hour">03:00</div> - <div class="1hour">04:00</div> - <div class="1hour">05:00</div> - </div> - <div id="monday"> <div class="weekday">{{ monday|date:"l d.m.Y" }}</div> {% for timeslot in monday_timeslots %} diff --git a/helsinki/program/urls.py b/helsinki/program/urls.py index b956ef6..06018e2 100644 --- a/helsinki/program/urls.py +++ b/helsinki/program/urls.py @@ -1,9 +1,19 @@ +from django.conf import settings from django.conf.urls.defaults import * from django.contrib import admin +import os + admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^program', include('helsinki.program.urls_program')), ) +if settings.DEBUG: + urlpatterns += patterns('', + (r'^site_media/(?P<path>.*)$', + 'django.views.static.serve', + {'document_root': os.path.join(os.path.dirname(__file__), 'site_media')} + ), + ) |