From b86196ca91726da011a6ef22a765dcc30345e353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Wed, 19 Oct 2016 14:01:07 +0200 Subject: [PATCH] consider talk with zero duration as unscheduled --- planning/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/planning/models.py b/planning/models.py index d97e80d..dd17884 100644 --- a/planning/models.py +++ b/planning/models.py @@ -2,6 +2,7 @@ from django.db import models from django.contrib.sites.models import Site from django.core.urlresolvers import reverse +from django.db.models import Q from autoslug import AutoSlugField @@ -30,8 +31,8 @@ class Room(models.Model): @property def talks_by_date(self): - return self.talks.filter(start_date__isnull=False).order_by('start_date').all() + return self.talks.filter(start_date__isnull=False).exclude(Q(duration=0) | Q(event__duration=0)).order_by('start_date').all() @property def unscheduled_talks(self): - return self.talks.filter(start_date__isnull=True).all() + return self.talks.filter(Q(start_date__isnull=True) | Q(duration=0, event__duration=0)).all()