def _process_mass_form(f):

    def wrap(request, *args, **kwargs):
        "Wrap"
        user = request.user.profile
        if 'massform' in request.POST:
            for key in request.POST:
                if 'mass-setting' in key:
                    try:
                        report = NotificationSetting.objects.get(pk=request.POST[key])
                        form = MassActionForm(
                            user, request.POST, instance=report)
                        if form.is_valid() and user.has_permission(report, mode='w'):
                            form.save()
                    except:
                        pass

        return f(request, *args, **kwargs)

    # can use functools.update_wrapper instead
    wrap.__doc__ = f.__doc__
    wrap.__name__ = f.__name__

    return wrap
Pre-process request to handle mass action form for NotificationSetting
dataset/ETHPy150Open treeio/treeio/treeio/account/views.py/_process_mass_form