aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__init__.py2
-rw-r--r--management/commands/_private.py2
-rw-r--r--models.py13
3 files changed, 10 insertions, 7 deletions
diff --git a/__init__.py b/__init__.py
index 820bcfa..fd9e129 100644
--- a/__init__.py
+++ b/__init__.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>.
-VERSION = "0.11.1-pa1ch"
+VERSION = "0.11.2-pa1ch"
__version__ = VERSION
default_app_config = "edt.apps.EdtConfig"
diff --git a/management/commands/_private.py b/management/commands/_private.py
index b663454..4dd9262 100644
--- a/management/commands/_private.py
+++ b/management/commands/_private.py
@@ -54,7 +54,7 @@ def get_event(timetable, event, event_week, today):
end = add_time(date, event.endtime.text)
# On ne traite pas le cours si il commence après le moment du traitement
- if begin < today:
+ if today is not None and begin < today:
return
# Création de l’objet cours
diff --git a/models.py b/models.py
index 0804a38..6d06793 100644
--- a/models.py
+++ b/models.py
@@ -57,7 +57,8 @@ class Timetable(SlugModel):
url = models.URLField(max_length=255, verbose_name="URL")
slug = models.SlugField(max_length=64, default="")
- last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat", null=True)
+ last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat",
+ null=True, blank=True)
def __str__(self):
return self.year.name + " " + self.name
@@ -71,10 +72,12 @@ class Timetable(SlugModel):
class GroupManager(Manager):
def get_parents(self, group):
- groups_criteria = Q(subgroup="") | Q(subgroup__startswith=group.subgroup) | \
- reduce(lambda x, y: x | y,
- [Q(subgroup=group.subgroup[:i])
- for i in range(1, len(group.subgroup) + 1)])
+ groups_criteria = Q(subgroup="") | Q(subgroup__startswith=group.subgroup)
+
+ if len(group.subgroup) != 0:
+ groups_criteria |= reduce(lambda x, y: x | y,
+ [Q(subgroup=group.subgroup[:i])
+ for i in range(1, len(group.subgroup) + 1)])
return self.get_queryset().filter(groups_criteria, mention=group.mention,
timetable=group.timetable)