def post(self, request, project_id, usergroup_id):
        """
        Updates the user group filter based on the data entered by the user.

        Parameter
        ---------
        request : django.http.HttpRequest
            Object representing the request
        project_id : int
            Identifies the project in the database
        usergroup_id : int
            Identifies the user group in the database

        Returns
        -------
        django.http.HttpResponse
            Rendered template when user group updated
        django.http.HttpResponse
            Rendered template, if project or user group does not exist
        """

        data = request.POST
        context = self.get_context_data(project_id, usergroup_id)
        usergroup = context.get('usergroup')

        if usergroup:
            cannot_modify = 'User group data cannot be modified.'

            if usergroup.project.islocked:
                messages.error(
                    self.request,
                    'The project is locked. %s' % cannot_modify
                )
            elif usergroup.project.categories.count() == 0:
                messages.error(
                    self.request,
                    cannot_modify % 'The project has no categories. %s'
                )
            else:
                if data['filters'] != '-1':
                    if data['permission'] == 'all':
                        usergroup.filters = None
                    else:
                        usergroup.filters = json_loads(data['filters'])

                    usergroup.save()

                    messages.success(
                        self.request,
                        'The user group has been updated.'
                    )

        return self.render_to_response(context)
dataset/ETHPy150Open ExCiteS/geokey/geokey/users/views.py/UserGroupData.post/swapped operands of `%`