Sync club pages with club tree

This commit is contained in:
Antoine Bartuccio 2017-09-13 16:51:34 +02:00
parent 939146bddd
commit e2078a8c15
Signed by: klmp200
GPG Key ID: E7245548C53F904B

View File

@ -116,6 +116,8 @@ class Club(models.Model):
if public:
p.view_groups.add(public)
p.save()
if self.parent and self.parent.page:
p.parent = self.parent.page
self.page = p
self.save()
elif self.page and self.page.name != self.unix_name:
@ -123,6 +125,11 @@ class Club(models.Model):
self.page.set_lock(root)
self.page.name = self.unix_name
self.page.save()
elif self.page and self.parent and self.parent.page and self.page.parent != self.parent.page:
self.page.unset_lock()
self.page.set_lock(root)
self.page.parent = self.parent.page
self.page.save()
def save(self, *args, **kwargs):
with transaction.atomic():