diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -37,10 +37,10 @@ class Group(models.Model): name = models.CharField(max_length=255, verbose_name="nom") timetable = models.ForeignKey(Timetable, on_delete=models.CASCADE, verbose_name="emploi du temps") - mention = models.CharField(max_length=32, db_index=True) - subgroup = models.CharField(max_length=1, verbose_name="sous-groupe", db_index=True) - td = models.IntegerField(verbose_name="groupe de TD", null=True, db_index=True) - tp = models.IntegerField(verbose_name="groupe de TP", null=True, db_index=True) + mention = models.CharField(max_length=32) + subgroup = models.CharField(max_length=1, verbose_name="sous-groupe") + td = models.IntegerField(verbose_name="groupe de TD", null=True) + tp = models.IntegerField(verbose_name="groupe de TP", null=True) slug = models.SlugField(max_length=64, unique=True, default="") @@ -67,7 +67,9 @@ class Group(models.Model): class Meta: + index_together = ("mention", "subgroup", "td", "tp",) unique_together = ("name", "timetable",) + verbose_name = "groupe" verbose_name_plural = "groupes" @@ -75,7 +77,7 @@ class Group(models.Model): 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) + active = models.BooleanField(verbose_name="activé", default=False, db_index=True) token = models.CharField(max_length=64, unique=True, default="") def save(self): @@ -85,7 +87,6 @@ class Subscription(models.Model): class Meta: - index_together = ("group", "active",) unique_together = ("email", "group",) verbose_name = "abonnement" verbose_name_plural = "abonnements" |