aboutsummaryrefslogtreecommitdiff
path: root/models.py
diff options
context:
space:
mode:
authorAlban Gruin2017-01-22 15:27:02 +0100
committerAlban Gruin2017-01-22 15:27:02 +0100
commit35ecadcbe283b2c1368141be5bec16d66c443f7c (patch)
tree3201d747c0f43976fd0eda7bbf4cd3b28cf75285 /models.py
parent6cb64910d0c96f144fef7a42f2b2883474031959 (diff)
Ajout du modèle des inscriptions pour les notifications par email
Diffstat (limited to 'models.py')
-rw-r--r--models.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/models.py b/models.py
index d01dbf0..9f9387d 100644
--- a/models.py
+++ b/models.py
@@ -64,9 +64,23 @@ class Group(models.Model):
class Meta:
+ unique_together = ("name", "timetable",)
verbose_name = "groupe"
verbose_name_plural = "groupes"
- unique_together = ("name", "timetable",)
+
+
+class Subscription(models.Model):
+ email = models.EmailField(verbose_name="adresse")
+ group = models.ForeignKey(Group, on_delete=models.CASCADE, verbose_name="groupe")
+ active = models.BooleanField(verbose_name="activé", default=False)
+ token = models.CharField(max_length=64, unique=True, default="")
+
+
+ class Meta:
+ index_together = ("group", "active",)
+ unique_together = ("email", "group",)
+ verbose_name = "abonnement"
+ verbose_name_plural = "abonnements"
class Room(models.Model):