Add getattribute to PageRev for getting owner_group&co

This commit is contained in:
Skia 2015-12-08 09:46:40 +01:00
parent aa732a4ec0
commit f7bfd6daed

View File

@ -315,6 +315,16 @@ class PageRev(models.Model):
def __str__(self): def __str__(self):
return str(self.__dict__) return str(self.__dict__)
def __getattribute__(self, attr):
if attr == "owner_group":
return self.page.owner_group
elif attr == "edit_group":
return self.page.edit_group
elif attr == "view_group":
return self.page.view_group
else:
return object.__getattribute__(self, attr)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
super(PageRev, self).save(*args, **kwargs) super(PageRev, self).save(*args, **kwargs)
# Don't forget to unlock, otherwise, people will have to wait for the page's timeout # Don't forget to unlock, otherwise, people will have to wait for the page's timeout