diff options
author | Johannes Raggam <raggam-nl@adm.at> | 2011-07-07 14:15:26 (GMT) |
---|---|---|
committer | Johannes Raggam <raggam-nl@adm.at> | 2011-07-07 14:15:26 (GMT) |
commit | 7fedd9d25afc2267c23121770d7aef17e9141f0d (patch) | |
tree | 13b6455d004067b8e365fde9a2f9f1ad30a5e6fa | |
parent | b8192f77d559684825af175dd31ce18c6c38096c (diff) | |
parent | f77ca392735c58e12f3fa5e4f7badf4c6e13f7ae (diff) |
Merge branch 'master' of github.com:nnrcschmdt/helsinki
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | program/admin.py | 16 | ||||
-rw-r--r-- | program/models.py | 4 | ||||
-rw-r--r-- | program/urls.py | 4 | ||||
-rw-r--r-- | templates/program/show_detail.html | 7 | ||||
-rw-r--r-- | templates/program/timeslot_detail.html | 2 |
6 files changed, 14 insertions, 21 deletions
@@ -1,2 +0,0 @@ -* integrate open ID -* integrate Disqus diff --git a/program/admin.py b/program/admin.py index 63fc2e2..9c744e3 100644 --- a/program/admin.py +++ b/program/admin.py @@ -24,25 +24,17 @@ class NoteAdmin(admin.ModelAdmin): date_hierarchy = 'start' exclude = ('owner',) list_display = ('title', 'show', 'start', 'status') - list_filter = ('status', 'show') + 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) + return super(NoteAdmin, self).queryset(request).filter(owner=request.user) def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == 'timeslot': one_year_ago = datetime.today() - timedelta(days=365) - if request.user.is_superuser: - kwargs['queryset'] = TimeSlot.objects.filter(start__gt=one_year_ago, note__isnull=True) - else: - shows = request.user.shows.all() - kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago, note__isnull=True) + shows = request.user.shows.all() + kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago) return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) diff --git a/program/models.py b/program/models.py index a63fcc7..8f2e50b 100644 --- a/program/models.py +++ b/program/models.py @@ -262,7 +262,7 @@ class TimeSlot(models.Model): programslot = models.ForeignKey(ProgramSlot, related_name='timeslots', verbose_name=_("Program slot")) start = models.DateTimeField(_("Start time"), unique=True) end = models.DateTimeField(_("End time")) - show = models.ForeignKey(Show, editable=False) + show = models.ForeignKey(Show, editable=False, related_name='timeslots') objects = TimeSlotManager() @@ -298,7 +298,7 @@ class Note(models.Model): 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) + show = models.ForeignKey(Show, editable=False, related_name='notes') created = models.DateTimeField(auto_now_add=True, editable=False) last_updated = models.DateTimeField(auto_now=True, editable=False) diff --git a/program/urls.py b/program/urls.py index 60d81a7..7176382 100644 --- a/program/urls.py +++ b/program/urls.py @@ -5,9 +5,6 @@ from django.views.generic.list_detail import object_detail, object_list from models import Host, Show, TimeSlot from views import current_show, day_schedule, recommendations, show_list, week_schedule -import os -PROGRAM_STATIC_DIR = os.path.join(os.path.dirname(__file__), '../site_media') - hosts_dict = { 'queryset': Host.objects.all(), 'template_object_name': 'host' @@ -35,5 +32,4 @@ urlpatterns = patterns('', url(r'^shows/(?P<slug>[\w-]+)/?$', object_detail, shows_dict, name='show-detail'), url(r'^(?P<object_id>\d+)/?$', object_detail, timeslots_dict, name='timeslot-detail'), url(r'^week/?$', week_schedule), - url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': PROGRAM_STATIC_DIR}), ) diff --git a/templates/program/show_detail.html b/templates/program/show_detail.html index 443a64a..ae1690a 100644 --- a/templates/program/show_detail.html +++ b/templates/program/show_detail.html @@ -11,11 +11,13 @@ <div class="show-detail-header bf-{{show.broadcastformat.slug}}"> <div class="show-details"> <h1 id="name">{{ show.name }}</h1> + {% if show.id != 1 %} <p id="programslots"> {% for slot in show.programslots.all %} <span class="programslot">{{ slot }}</span><br /> {% endfor %} </p> + {% endif %} </div> <div class="show-categorization"> @@ -54,6 +56,11 @@ {% endif %} </p> + <p> + {% for note in show.notes.all %} + <a href="{% url timeslot-detail note.timeslot.id %}" title="{{ note.title }}">{{ note.start|date:"d. M Y" }}</a> + {% endfor %} + </p> </div> </body> diff --git a/templates/program/timeslot_detail.html b/templates/program/timeslot_detail.html index 7955451..8b08f8b 100644 --- a/templates/program/timeslot_detail.html +++ b/templates/program/timeslot_detail.html @@ -7,7 +7,7 @@ <div id="content-main" class="timeslot-detail"> <div class="show-detail-header bf-{{timeslot.show.broadcastformat.slug}}"> - <h1 id="name">{{ timeslot.show.name }}</h1> + <h1 id="name"><a href="{% url show-detail timeslot.show.slug %}">{{ timeslot.show.name }}</a></h1> <div class="show-abbrevs"> {% for item in timeslot.show.showinformation.all %} |