def post(self, request, **kwargs):
        """ HTML post for /cms/types/<id>/edit
        :param request: the request object
        :param kwargs: contains node_id
        :return: response object
        """
        page_type = get_object_or_404(PageType, id=kwargs['type_id'])
        permissions_form = self.permissions_form_class(request.POST)
        groups = Group.objects.all().count()
        if permissions_form.is_valid():
            if request.user.has_perm(('guardian.add_groupobjectpermission',
                                      'guardian.change_groupobjectpermission',
                                      'guardian.delete_groupobjectpermission')):
                set_perms(page_type, list(permissions_form.fields.keys()), '_pagetype', permissions_form.cleaned_data)
            messages.success(request, _("Content type '%s' has been updated.") % page_type.name)
            return redirect('admin:ninecms_pagetype_changelist')
        else:  # pragma: nocover
            messages.warning(request, _("Content type has not been updated. Please check the form for errors."))
            return render(request, 'admin/ninecms/pagetype/perms_form.html', {
                'permissions_form': permissions_form,
                'groups': groups,
                'page_type': page_type,
            })
dataset/ETHPy150Open Wtower/django-ninecms/ninecms/views.py/ContentTypePermsView.post/original