def approve_user(request):
    profile = request.user.get_profile()
    if (not profile.is_net_admin):
        return HttpResponseRedirect("/dashboard")
    
    error_msg = []
    if (request.method == "POST"):
        
        keys = request.POST.keys()
        for key in keys:
            if key.startswith("req_"):
                try:
                    req_id = int(key[4:len(key)])
                    op_req = RequestedUserFlowSpace.objects.get(id=req_id)
                except Exception,e:
                    error_msg.append("%s is not a vlid request id!"%key)
                
                decision = request.POST[key]
                if (decision=="accept"):
                    op_profile = op_req.user.get_profile()
                    op_profile.max_priority_level = Priority.Strict_User
                    op_profile.save()
            
                    [fv_args, match_list] = accept_user_fs_request([op_req])
                    try:
                        fv = FVServerProxy.objects.all()[0]
                        if len(fv_args) > 0:
                            returned_ids = fv.proxy.api.changeFlowSpace(fv_args)
                            for i in range(len(match_list)):
                                match_list[i].fv_id = returned_ids[i]
                                match_list[i].save()

                    except Exception,e:
                        import traceback
                        traceback.print_exc()
                        transaction.rollback()
                    
            
                elif (decision=="reject"):
                    send_approve_or_reject_email([op_req],False)
                    op_req.delete() 
                       
    
    reqs = RequestedUserFlowSpace.objects.filter(admin=request.user).order_by('-user')
    # find all the conflicts between reqs themselves and between them and already 
    # approved flowspaces
        
    reqs_and_conflicts = []
    for req in reqs:
        new_conflicts = []
        all_user_fs = UserFlowSpace.objects.filter(~Q(user=req.user))
        all_user_fs_req = RequestedUserFlowSpace.objects.filter(~Q(user=req.user) & Q(admin=request.user))
        for fs in all_user_fs:
            if flowspaces_intersect_and_have_common_nonwildcard(req,fs):
                new_conflicts.append("Conflict with %s %s (username: %s)'s flowspace approved by %s %s (username: %s): %s "%
                        (fs.user.first_name,fs.user.last_name,fs.user.username,
                         fs.approver.first_name, fs.approver.last_name, fs.approver.username,fs)
                    )
        for fs in all_user_fs_req:
            if flowspaces_intersect_and_have_common_nonwildcard(req,fs):
                new_conflicts.append("Conflict with %s %s (username: %s)'s pending flowspace request: %s "%
                        (fs.user.first_name,fs.user.last_name,fs.user.username,fs)
                    )
                
        if len(new_conflicts) > 0:
            reqs_and_conflicts.append({"req":req,"conflicts":new_conflicts})
        else:
            reqs_and_conflicts.append({"req":req,"conflicts":0})
        
    return simple.direct_to_template(request, 
            template = "openflow/optin_manager/admin_manager/approve_user.html",
            extra_context = {
                        'reqs': reqs_and_conflicts,
                        'user':request.user,
                        'error_msg':error_msg,
                    },
        )
Override factory in the base class to create a single instance of
dataset/ETHPy150Open fp7-ofelia/ocf/optin_manager/src/python/openflow/optin_manager/admin_manager/views.py/approve_user--crossover with--dataset/ETHPy150Open dave-tucker/hp-sdn-client/hpsdnclient/datatypes.py/Flow.factory