def post(self, request, **kwargs):
        change_count = 0
        actions = defaultdict(list)

        for message_string, action in request.POST.iteritems():
            if not message_string.startswith('message-'):
                continue
            message_id = message_string.split('-')[1]
            if message_id.isdigit() and action in POSSIBLE_ACTIONS:
                actions[action].append(message_id)

        if actions:
            change_count += moderate_messages(actions, request.user)

        if not change_count:
            messages.warning(request, 'No Messages Updated')
        else:
            pluralized_message = 'Messages' if change_count > 1 else 'Message'
            messages.success(
                request, "Updated %s %s" % (change_count, pluralized_message))

        cache.delete('%s_messages_to_mod' % self.request.user.pk)
        return redirect(self.get_success_url(request))
Process moderation changes.
dataset/ETHPy150Open ofa/connect/open_connect/moderation/views.py/SubmitView.post