Skip to content
Snippets Groups Projects
Commit 55b2560b authored by Christian Pointner's avatar Christian Pointner
Browse files

show specials as recommendations even if there is no note attached

parent a7e37419
No related branches found
No related tags found
No related merge requests found
from django.views.generic import list_detail, simple from django.views.generic import list_detail, simple
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.db.models import Q
from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot
...@@ -29,10 +30,10 @@ def show_list(request): ...@@ -29,10 +30,10 @@ def show_list(request):
def recommendations(request, template_name='program/recommendations.html'): def recommendations(request, template_name='program/recommendations.html'):
now = datetime.now() now = datetime.now()
in_one_week = now + timedelta(weeks=1) end = now + timedelta(weeks=1)
queryset = Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:20]
queryset = TimeSlot.objects.filter(Q(note__isnull=False, note__status=1, start__range=(now, end)) |
Q(show__broadcastformat__slug='sondersendung', start__range=(now, end))).order_by('start')[:20]
return list_detail.object_list(request, queryset=queryset, template_name=template_name, template_object_name='recommendation') return list_detail.object_list(request, queryset=queryset, template_name=template_name, template_object_name='recommendation')
def day_schedule(request, year=None, month=None, day=None): def day_schedule(request, year=None, month=None, day=None):
......
...@@ -16,16 +16,26 @@ ...@@ -16,16 +16,26 @@
<td class="format bf-{{ item.show.broadcastformat.slug }}" <td class="format bf-{{ item.show.broadcastformat.slug }}"
title="{{ item.show.broadcastformat.format }}">&nbsp;</td> title="{{ item.show.broadcastformat.format }}">&nbsp;</td>
<td class="show"> <td class="show">
{{ item.timeslot.start|date:"d.m. H:i" }} - {{ item.start|date:"d.m. H:i" }} -
{{ item.timeslot.end|date:"H:i" }}<br /> {{ item.end|date:"H:i" }}<br />
<h3> {% if item.note %}
<a href="{% url timeslot-detail item.timeslot.id %}">{{ item.show.name }}</a> <h3>
</h3> <a href="{% url timeslot-detail item.id %}">{{ item.show.name }}</a>
<p class="note-title"> </h3>
{{ item.title }}<br /> <p class="note-title">
<a href="{% url timeslot-detail item.timeslot.id %}">[weiter]</a> {{ item.note.title }}<br />
</p> <a href="{% url timeslot-detail item.id %}">[weiter]</a>
</p>
{% else %}
<h3>
<a href="{% url show-detail item.show.slug %}">{{ item.show.name }}</a>
</h3>
<p class="note-title">
{{ item.show.broadcastformat.format }}<br />
<a href="{% url show-detail item.show.slug %}">[weiter]</a>
</p>
{% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment