diff options
author | Alban Gruin | 2017-09-04 21:43:40 +0200 |
---|---|---|
committer | Alban Gruin | 2017-09-04 21:43:40 +0200 |
commit | 8526c4588d88e98f59611771dbc0ca34c1b66d66 (patch) | |
tree | aef674c0c07991540b02203c1318b634404d43c6 /models.py | |
parent | 276158c7813cb75df3ea433d3b8543bdf5c7b7d3 (diff) |
Rennomage de parent_group en parent.
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() |