From 35e740a416605d3dbe6733ca7dc6497225eb5f58 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sat, 2 Jul 2011 22:22:03 +0200 Subject: removed show from filter for note admin. diff --git a/program/admin.py b/program/admin.py index 63fc2e2..ad9d725 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, note__isnull=True) return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) -- cgit v0.10.2 From d50d344dfe0d994ff0ca2a58226aabccbb0eaeb6 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 11:23:14 +0200 Subject: site_media is served by Apache. 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[\w-]+)/?$', object_detail, shows_dict, name='show-detail'), url(r'^(?P\d+)/?$', object_detail, timeslots_dict, name='timeslot-detail'), url(r'^week/?$', week_schedule), - url(r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': PROGRAM_STATIC_DIR}), ) -- cgit v0.10.2 From 67e50e0a53c78897edd515e6753511bb540f107b Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 11:44:29 +0200 Subject: added missing related names. 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) -- cgit v0.10.2 From 16dbcbeb27e4a5e722db2fad6100583b91e80a72 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 11:44:56 +0200 Subject: added direct link to show detail page. 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 @@
-

{{ timeslot.show.name }}

+

{{ timeslot.show.name }}

{% for item in timeslot.show.showinformation.all %} -- cgit v0.10.2 From cc7b17fead189eb2afb7524b3288e5453efe9047 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 11:45:47 +0200 Subject: added list of notes to show detail page. this looks ugly I know. diff --git a/templates/program/show_detail.html b/templates/program/show_detail.html index 443a64a..9d60678 100644 --- a/templates/program/show_detail.html +++ b/templates/program/show_detail.html @@ -54,6 +54,11 @@ {% endif %}

+

+ {% for note in show.notes.all %} + {{ note.start|date:"d. M Y" }} + {% endfor %} +

-- cgit v0.10.2 From a5a5567dc78de1fe2de22b9f9651d63a3918291a Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 11:57:27 +0200 Subject: don't show timeslots for musikprogramm. diff --git a/templates/program/show_detail.html b/templates/program/show_detail.html index 9d60678..ae1690a 100644 --- a/templates/program/show_detail.html +++ b/templates/program/show_detail.html @@ -11,11 +11,13 @@

{{ show.name }}

+ {% if show.id != 1 %}

{% for slot in show.programslots.all %} {{ slot }}
{% endfor %}

+ {% endif %}
-- cgit v0.10.2 From d3bc837909b7583828b0cbe81446374e0bb86f0b Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 12:01:31 +0200 Subject: I'm done. diff --git a/TODO b/TODO index 9b3c626..e69de29 100644 --- a/TODO +++ b/TODO @@ -1,2 +0,0 @@ -* integrate open ID -* integrate Disqus -- cgit v0.10.2 From f77ca392735c58e12f3fa5e4f7badf4c6e13f7ae Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 3 Jul 2011 20:38:43 +0200 Subject: removed note__isnull. it may causes confusion. diff --git a/program/admin.py b/program/admin.py index ad9d725..9c744e3 100644 --- a/program/admin.py +++ b/program/admin.py @@ -34,7 +34,7 @@ class NoteAdmin(admin.ModelAdmin): if db_field.name == 'timeslot': one_year_ago = datetime.today() - timedelta(days=365) shows = request.user.shows.all() - kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago, note__isnull=True) + kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago) return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) -- cgit v0.10.2