def permissions_dashboard(request):
    """
    Display a list of current requests and buttons to approve/deny.
    """
    
    perm_reqs = PermissionRequest.objects.filter(
        permission_owner=request.user)
    
    my_perms = ObjectPermission.objects.filter(
        permittees__object_type=ContentType.objects.get_for_model(User),
        permittees__object_id=request.user.id)
    
    def filter_id(id):
        try:
            return int(id)
        except ValueError:
            pass
    
    if request.method == "POST":
        # list of approved requests
        approved_req_ids = set(map(filter_id, request.POST.getlist("approved")))
        # list of delegated requests
        delegatable_req_ids = set(map(filter_id, request.POST.getlist("delegate")))
        # list of denied requests
        denied_req_ids = set(map(filter_id, request.POST.getlist("denied")))
        # check that all ids exist
        found_ids = set(
            perm_reqs.filter(
                Q(pk__in=approved_req_ids) | Q(pk__in=denied_req_ids)
            ).values_list("pk", flat=True))
        
        for req_id in approved_req_ids.union(denied_req_ids):
            if found_ids not in req_id:
                raise Http404(
                    "Permission request with ID %s not found." % req_id)
        
        # store the request and redirect to a confirmation page
        request.session["approved_req_ids"] = approved_req_ids
        request.session["delegatable_req_ids"] = delegatable_req_ids
        request.session["denied_req_ids"] = denied_req_ids

        return HttpResponseRedirect(reverse(confirm_requests))
    
    else:
        return simple.direct_to_template(
            request,
            template=TEMPLATE_PATH+"/dashboard.html",
            extra_context=dict(
                perm_reqs=perm_reqs,
                my_perms=my_perms,
            ),
        )
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/permissionmgmt/views.py/permissions_dashboard/swapped operands of `not in`