diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 14 |
1 files changed, 1 insertions, 13 deletions
@@ -72,7 +72,7 @@ class Group(models.Model): subgroup = models.CharField(max_length=1, verbose_name="sous-groupe", null=True) td = models.IntegerField(verbose_name="groupe de TD", null=True) tp = models.IntegerField(verbose_name="groupe de TP", null=True) - parent_group = models.ForeignKey("self", verbose_name="groupe parent", null=True, default=None, related_name="children") + parent = models.ForeignKey("self", verbose_name="groupe parent", null=True, default=None, related_name="children") slug = models.SlugField(max_length=64, default="") @@ -92,18 +92,6 @@ class Group(models.Model): self.slug = slugify(self.name) self.mention, self.subgroup, self.td, self.tp = parse_group(self.name) - - group_content_list = [self.mention, self.subgroup, self.td, self.tp] - group_content_keys = ("mention", "subgroup", "td", "tp") - for i in range(len(group_content_list))[::-1]: - if group_content_list[i] is not None: - group_content_list[i] = None - break - - if group_content_list[1] is not None: - group_content = dict(zip(group_content_keys, group_content_list)) - self.parent_group_id = Group.objects.filter(**group_content).first().id - super(Group, self).save() |