diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 24 |
1 files changed, 0 insertions, 24 deletions
@@ -20,9 +20,6 @@ from django.utils.text import slugify from .utils import parse_group -import hashlib -import os - class Year(models.Model): name = models.CharField(max_length=16, verbose_name="année") @@ -118,27 +115,6 @@ class Group(models.Model): verbose_name_plural = "groupes" -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, db_index=True) - token = models.CharField(max_length=64, unique=True, default="") - - def __str__(self): - return "{0} - {1}".format(self.email, self.group) - - def save(self, *args, **kwargs): - if self.token == "": - self.token = hashlib.sha1(os.urandom(128)).hexdigest() - super(Subscription, self).save(*args, **kwargs) - - - class Meta: - unique_together = ("email", "group",) - verbose_name = "abonnement" - verbose_name_plural = "abonnements" - - class Room(models.Model): name = models.CharField(max_length=255, unique=True, verbose_name="nom") |