0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Added __str__() to GroupPagePermissions.

It returns the same format as GroupCollectionPermissions.
This commit is contained in:
Robert Rollins 2016-05-27 17:38:39 -07:00 committed by Matt Westcott
parent 87e9c63dbf
commit 6ae36c0baa

View File

@ -1529,6 +1529,7 @@ PAGE_PERMISSION_TYPE_CHOICES = [
]
@python_2_unicode_compatible
class GroupPagePermission(models.Model):
group = models.ForeignKey(Group, verbose_name=_('group'), related_name='page_permissions', on_delete=models.CASCADE)
page = models.ForeignKey('Page', verbose_name=_('page'), related_name='group_permissions', on_delete=models.CASCADE)
@ -1543,6 +1544,13 @@ class GroupPagePermission(models.Model):
verbose_name = _('group page permission')
verbose_name_plural = _('group page permissions')
def __str__(self):
return "Group %d ('%s') has permission '%s' on page %d ('%s')" % (
self.group.id, self.group,
self.permission_type,
self.page.id, self.page
)
class UserPagePermissionsProxy(object):
"""Helper object that encapsulates all the page permission rules that this user has