mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Sync club pages with club tree
This commit is contained in:
parent
939146bddd
commit
e2078a8c15
@ -116,6 +116,8 @@ class Club(models.Model):
|
|||||||
if public:
|
if public:
|
||||||
p.view_groups.add(public)
|
p.view_groups.add(public)
|
||||||
p.save()
|
p.save()
|
||||||
|
if self.parent and self.parent.page:
|
||||||
|
p.parent = self.parent.page
|
||||||
self.page = p
|
self.page = p
|
||||||
self.save()
|
self.save()
|
||||||
elif self.page and self.page.name != self.unix_name:
|
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.set_lock(root)
|
||||||
self.page.name = self.unix_name
|
self.page.name = self.unix_name
|
||||||
self.page.save()
|
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):
|
def save(self, *args, **kwargs):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
Loading…
Reference in New Issue
Block a user