From 4edb31db07b8f966a8f2ffe4c63e1036c1acca25 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Thu, 7 Apr 2011 19:33:39 +0200 Subject: cherry-picked commits from develop branch. diff --git a/TODO b/TODO index ae300ac..7ffd2ac 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,4 @@ -* create style sheet and update templates -* integrate django-haystack * integrate calendar into day schedule view * integrate tinyMCE into admin site * integrate open ID * integrate Disqus -* i18n -* user management with different rights and roles 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 %}
{{ current.note.title }}
{% else %} -
{{ current.show.short_description }}
+ {% if current.show.short_description != 'FIMXE' %} +
{{ current.show.short_description }}
+ {% endif %} {% endif %} 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 %}
Heute: {{ timeslot.note.title }}
{% else %} + {% if timeslot.show.short_description != 'FIXME' %}
{{ timeslot.show.short_description }}
+ {% endif %} {% endif %} 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 @@ Host detail: {{ host.name }} +
{{ host.name }}
+
+
Sendungen
+ + {% for show in host.shows.all %} + + {% endfor %} +
+ {% if host.email %} -
{{ host.email }}
+
E-Mail Adresse: {{ host.email }}
{% endif %} {% if host.website %} -
{{ host.website }}
+ {% endif %}
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 @@ Host list + 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 @@ Recomendations +
-{% for note in recommendations %} -
-
{{ note.show.broadcastformat }}
-
{{ note.timeslot.start }}
- -
{{ note.show.short_description }}
-
{{ note.title }}
-
{{ note.content }}
+{% for recommendation in recommendations %} +
+
{{ recommendation.timeslot.start|date:"d.m.Y H:i" }} - {{ recommendation.timeslot.end|date:"H:i" }}
+ + {% if recommendation.show.short_description != 'FIXME' %} +
{{ recommendation.show.short_description }}
+ {% endif %} + +
{{ recommendation.content|safe}}
{% endfor %}
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 %}
+ {% if show.short_description != 'FIXME' %}
{{ show.short_description }}
+ {% endif %} -
{{ show.description }}
+
{{ show.description|safe }}
{% if show.email %}
{{ show.email }}
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 @@ Show list + -
-{% for topic in showtopics %} -
- {{ topic.abbrev }} - {{ topic }} +
+
Filter
+ +
+
Thema/Schwerpunkt
+ {% for topic in showtopics %} +
+ {{ topic.abbrev }} + {{ topic }} +
+ {% endfor %}
-{% endfor %} -
-
-{% for information in showinformations %} -
- {{ information.abbrev }} - {{ information }} +
+
+ {% for information in showinformations %} +
+ {{ information.abbrev }} + {{ information }} +
+ {% endfor %}
-{% endfor %} -
-
-{% for focus in musicfoci %} -
- {{ focus.abbrev }} - {{ focus }} +
+
Musiktendenz
+ {% for focus in musicfoci %} +
+ {{ focus.abbrev }} + {{ focus }} +
+ {% endfor %}
-{% endfor %}
-
+
{% for show in shows %}
-
- {% for topic in show.showtopic.all %} +
  + {% for topic in show.showtopic.all %} {{ topic.abbrev }} - {% endfor %} + {% endfor %} - {% for information in show.showinformation.all %} + {% for information in show.showinformation.all %} {{ information.abbrev }} - {% endfor %} + {% endfor %} - {% for focus in show.musicfocus.all %} + {% for focus in show.musicfocus.all %} {{ focus.abbrev }} - {% endfor %} + {% endfor %} {{ show.broadcastformat.abbrev }}
- +
+ -
- {% for slot in show.programslots.all %} -
{{ slot }}
- {% endfor %} -
+
+ {% for slot in show.programslots.all %} +
{{ slot }}
+ {% endfor %} +
-
{{ show.short_description }}
+ {% if show.short_description != 'FIXME' %} +
{{ show.short_description }}
+ {% endif %} +
{% endfor %}
-
-{% for format in broadcastformats %} -
{{ format }}
-{% endfor %} +
+
Legende
+ {% for broadcastformat in broadcastformats %} + + {% endfor %}
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 @@ Timeslot detail: {{ timeslot }} + -
-
-
{{ timeslot.show.name }}
+
{{ timeslot.show.name }}
{% for topic in timeslot.show.showtopic.all %} @@ -35,19 +34,21 @@
{% for host in timeslot.show.hosts.all %} -
{{ host }}
+ {% endfor %}
+ {% if timeslot.show.short_description != 'FIXME' %}
{{ timeslot.show.short_description }}
+ {% endif %} -
{{ timeslot.show.description }}
+
{{ timeslot.show.description|safe }}
{% if timeslot.note %}
{{ timeslot.note.title }}
-
{{ timeslot.note.content }}
+
{{ timeslot.note.content|safe }}
{% endif %}
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 @@ Week schedule +
-
-
06:00
-
07:00
-
08:00
-
09:00
-
10:00
-
11:00
-
12:00
-
13:00
-
14:00
-
15:00
-
16:00
-
17:00
-
18:00
-
19:00
-
20:00
-
21:00
-
22:00
-
23:00
-
00:00
-
01:00
-
02:00
-
03:00
-
04:00
-
05:00
-
-
{{ monday|date:"l d.m.Y" }}
{% 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.*)$', + 'django.views.static.serve', + {'document_root': os.path.join(os.path.dirname(__file__), 'site_media')} + ), + ) -- cgit v0.10.2