aboutsummaryrefslogtreecommitdiff
path: root/models.py
diff options
context:
space:
mode:
authorAlban Gruin2019-06-09 18:21:51 +0200
committerAlban Gruin2019-06-09 18:21:51 +0200
commitdab185062a58b73c9770a5d474ff3c5cd5ebcebf (patch)
treed6671696feeff23f270e8c67765f4e791f7c5e02 /models.py
parent2386b8d41d88c1408411b378ce5e2a8c09c382e7 (diff)
parentb9f77648d0fb6897fad180627401c6b9c3e75943 (diff)
Merge branch 'ag/parser' into futur
Diffstat (limited to 'models.py')
-rw-r--r--models.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/models.py b/models.py
index c8e7b3d..b59f2d8 100644
--- a/models.py
+++ b/models.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Alban Gruin
+# Copyright (C) 2017-2019 Alban Gruin
#
# celcatsanitizer is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
@@ -200,6 +200,18 @@ class Room(SlugModel):
verbose_name_plural = "salles"
+class Module(SlugModel):
+ name = models.CharField(max_length=255, unique=True, verbose_name="nom")
+ slug = models.SlugField(max_length=64, default="", unique=True)
+
+ def __str__(self):
+ return self.name
+
+ class Meta:
+ verbose_name = "module"
+ verbose_name_plural = "modules"
+
+
class CourseManager(Manager):
def get_courses(self, obj, **criteria):
qs = self.get_queryset()
@@ -246,6 +258,9 @@ class Course(models.Model):
last_update = models.DateTimeField(verbose_name="dernière mise à jour",
default=timezone.now)
+ celcat_id = models.IntegerField(verbose_name="ID Celcat", null=True)
+ module = models.ForeignKey(Module, on_delete=models.SET_NULL, null=True)
+
def __str__(self):
return self.name