def update_permission_fieldsets(self, request, obj=None):
        """
        Nobody can grant more than he haves, so check for user permissions
        to Page and User model and render fieldset depending on them.
        """
        fieldsets = deepcopy(self.fieldsets)
        perm_models = (
            (Page, ugettext('Page permissions')),
            (PageUser, ugettext('User & Group permissions')),
            (PagePermission, ugettext('Page permissions management')),
        )
        for i, perm_model in enumerate(perm_models):
            model, title = perm_model
            opts, fields = model._meta, []
            name = model.__name__.lower()
            for key in ('add', 'change', 'delete'):
                perm_code = (opts.app_label, get_permission_codename(key, opts)) % '%s.%s'
                if request.user.has_perm(perm_code):
                    fields.append('can_%s_%s' % (key, name))
            if fields:
                fieldsets.insert(2 + i, (title, {'fields': (fields,)}))
        return fieldsets
dataset/ETHPy150Open divio/django-cms/cms/admin/permissionadmin.py/GenericCmsPermissionAdmin.update_permission_fieldsets/swapped operands of `%`