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

Merge branch 'stable'

parents 77dc22a2 25b6bfba
No related branches found
No related tags found
No related merge requests found
......@@ -19,21 +19,21 @@ class ActivityFilter(admin.SimpleListFilter):
def queryset(self, request, queryset):
if self.parameter_name == 'has_timeslots': # active/inactive ProgramSlots
if self.value() == 'yes':
return queryset.filter(until__gt=datetime.now()).distinct()
return queryset.filter(until__gt=datetime.now).distinct()
if self.value() == 'no':
return queryset.filter(until__lt=datetime.now()).distinct()
return queryset.filter(until__lt=datetime.now).distinct()
if self.parameter_name == 'has_programslots_timeslots': # active/inactive Shows
if self.value() == 'yes':
return queryset.filter(programslots__until__gt=datetime.now()).distinct()
return queryset.filter(programslots__until__gt=datetime.now).distinct()
if self.value() == 'no':
return queryset.filter(programslots__until__lt=datetime.now()).distinct()
return queryset.filter(programslots__until__lt=datetime.now).distinct()
if self.parameter_name == 'has_shows_programslots_timeslots': # active/inactive Hosts
if self.value() == 'yes':
return queryset.filter(shows__programslots__until__gt=datetime.now()).distinct()
return queryset.filter(shows__programslots__until__gt=datetime.now).distinct()
if self.value() == 'no':
return queryset.filter(shows__programslots__until__lt=datetime.now()).distinct()
return queryset.filter(shows__programslots__until__lt=datetime.now).distinct()
class ActiveProgramSlotsFilter(ActivityFilter):
......
......@@ -226,7 +226,7 @@ class Host(models.Model):
return reverse('host-detail', args=[str(self.id)])
def active_shows(self):
return self.shows.filter(programslots__until__gt=datetime.today())
return self.shows.filter(programslots__until__gt=datetime.today)
class Show(models.Model):
......@@ -404,16 +404,16 @@ class TimeSlotManager(models.Manager):
@staticmethod
def get_or_create_current():
try:
return TimeSlot.objects.get(start__lte=datetime.now(), end__gt=datetime.now())
return TimeSlot.objects.get(start__lte=datetime.now, end__gt=datetime.now)
except MultipleObjectsReturned:
return TimeSlot.objects.filter(start__lte=datetime.now(), end__gt=datetime.now())[0]
return TimeSlot.objects.filter(start__lte=datetime.now, end__gt=datetime.now)[0]
except ObjectDoesNotExist:
once = RRule.objects.get(pk=1)
today = date.today().weekday()
default = Show.objects.get(pk=1)
previous_timeslot = TimeSlot.objects.filter(end__lte=datetime.now()).order_by('-start')[0]
next_timeslot = TimeSlot.objects.filter(start__gte=datetime.now())[0]
previous_timeslot = TimeSlot.objects.filter(end__lte=datetime.now).order_by('-start')[0]
next_timeslot = TimeSlot.objects.filter(start__gte=datetime.now)[0]
dstart, tstart = previous_timeslot.end.date(), previous_timeslot.end.time()
until, tend = next_timeslot.start.date(), next_timeslot.start.time()
......
......@@ -13,7 +13,7 @@
{% if timeslot.note %}
<h2>{{ timeslot.note.title }}</h2>
{% endif %}
<strong>Sendung am {{ timeslot.start|date:"d.m. H:i" }} bis {{ timeslot.end|date:"H:i" }}</strong>
<strong>Sendung am {{ timeslot.start|date:"d.m.Y H:i" }} bis {{ timeslot.end|date:"H:i" }}</strong>
<div class="show-abbrevs">
{% for si in timeslot.show.showinformation.all %}
......
......@@ -15,7 +15,7 @@ from program.utils import tofirstdayinisoweek
class HostListView(ListView):
context_object_name = 'host_list'
queryset = Host.objects.filter(Q(is_always_visible=True) | Q(shows__programslots__until__gt=datetime.now())).distinct()
queryset = Host.objects.filter(Q(is_always_visible=True) | Q(shows__programslots__until__gt=datetime.now)).distinct()
template_name = 'host_list.html'
......
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