Exemplo n.º 1
0
def network_advertiser_add(request):
    ''' View to allow a Network Admin to create a new Advertiser '''
    from atrinsic.base.models import Currency, Organization, OrganizationCurrency
    from forms import NetworkAdvertiserEditForm
    if request.method == 'POST':
        form = NetworkAdvertiserEditForm(request.POST)

        if form.is_valid():
            try:
                if form.cleaned_data["country"] == "CA":
                    form.cleaned_data["state"] = form.cleaned_data['province']
            except:
                pass
            del form.cleaned_data['province']
            del form.cleaned_data['salesperson']
            
            curID = form.cleaned_data['currency']
            del form.cleaned_data['currency']
            
            org = Organization.objects.create(**form.cleaned_data)
            org.org_type = ORGTYPE_ADVERTISER
            org.status = ORGSTATUS_TEST
            org.save()
            
            orgCur = OrganizationCurrency.objects.create(advertiser = org, currency = Currency.objects.get(order=curID))
            return HttpResponseRedirect('/network/advertiser/settings/')
        
    else:
        form = NetworkAdvertiserEditForm()

    return AQ_render_to_response(request, 'network/advertiser-add.html', {
            'form' : form,
        }, context_instance=RequestContext(request))
Exemplo n.º 2
0
def network_advertiser_add(request):
    ''' View to allow a Network Admin to create a new Advertiser '''
    from atrinsic.base.models import Currency, Organization, OrganizationCurrency
    from forms import NetworkAdvertiserEditForm
    if request.method == 'POST':
        form = NetworkAdvertiserEditForm(request.POST)

        if form.is_valid():
            try:
                if form.cleaned_data["country"] == "CA":
                    form.cleaned_data["state"] = form.cleaned_data['province']
            except:
                pass
            del form.cleaned_data['province']
            del form.cleaned_data['salesperson']

            curID = form.cleaned_data['currency']
            del form.cleaned_data['currency']

            org = Organization.objects.create(**form.cleaned_data)
            org.org_type = ORGTYPE_ADVERTISER
            org.status = ORGSTATUS_TEST
            org.save()

            orgCur = OrganizationCurrency.objects.create(
                advertiser=org, currency=Currency.objects.get(order=curID))
            return HttpResponseRedirect('/network/advertiser/settings/')

    else:
        form = NetworkAdvertiserEditForm()

    return AQ_render_to_response(request,
                                 'network/advertiser-add.html', {
                                     'form': form,
                                 },
                                 context_instance=RequestContext(request))
Exemplo n.º 3
0
def network_advertiser_edit(request, id):
    ''' View to allow a Network Admin to edit and update an Advertiser's
        Organization Information '''
    from atrinsic.base.models import ProgramTermSpecialAction, OrganizationContacts, Organization_IO, OrganizationPaymentInfo, Organization, OrganizationCurrency, Currency
    from atrinsic.util.AceFieldLists import Ace
    from forms import NetworkAdvertiserEditForm, NetworkAdvertiserContactEditForm, NetworkAdvertiserOrgIOEditForm, NetworkAdvertiserBillingEditForm, NetworkAdvertiserSettingsEditForm, ProgramTermSpecialActionForm
    advertiser = get_object_or_404(
        request.user.get_profile().admin_assigned_advertisers(), id=id)

    try:
        orgContact = OrganizationContacts.objects.get(organization=advertiser)
    except:
        orgContact = None
    try:
        orgIO = Organization_IO.objects.get(organization=advertiser)
    except:
        orgIO = None

    client = Ace()
    form = None

    special_term, x = ProgramTermSpecialAction.objects.get_or_create(
        organization=advertiser)

    if request.method == 'POST':
        if request.POST.get("formtype", None):
            formType = request.POST.get("formtype")
            if formType == "form":
                form = NetworkAdvertiserEditForm(request.POST,
                                                 request.FILES,
                                                 instance=advertiser)
            elif formType == "formContactEdit":
                form = NetworkAdvertiserContactEditForm(
                    request.POST,
                    instance=OrganizationContacts.objects.get(
                        organization=advertiser))
            elif formType == "formBillingEdit":
                form = NetworkAdvertiserBillingEditForm(
                    request.POST,
                    instance=OrganizationPaymentInfo.objects.get(
                        organization=advertiser))
            elif formType == "formSettingsEdit":
                form = NetworkAdvertiserSettingsEditForm(request.POST,
                                                         instance=advertiser)
            elif formType == "formTermsEdit":
                form = ProgramTermSpecialActionForm(request.POST,
                                                    instance=special_term)
            elif formType == "formIOStatusUpdate":
                form = None
                if orgIO != None:
                    args = {}
                    args["ioId"] = orgIO.ace_ioid
                    args["statusId"] = APPROVED_BY_SALES_MANAGER
                    args["spId"] = request.POST.get("salesperson")
                    updateIOStatus(advertiser, args)
            elif formType == "formIOFeeSettingsEdit":
                form = NetworkAdvertiserOrgIOEditForm(request.POST,
                                                      instance=advertiser)
                if orgIO != None:
                    if form.is_valid():
                        orgIO.transaction_fee_type = request.POST.get(
                            "transaction_fee_type")
                        orgIO.transaction_fee_amount = request.POST.get(
                            "transaction_fee_amount")
                        orgIO.save()
                    else:
                        return HttpResponseRedirect(
                            '/network/advertiser/edit/%d/?error=1' % int(id))

                    form = None

                    if orgIO.salesrep == 0 or orgIO.salesrep == None:
                        orgIO.salesrep = request.POST.get("salesperson")
                        orgIO.save()
                    args = {}
                    args["ioId"] = orgIO.ace_ioid
                    args["spId"] = request.POST.get("salesperson")
                    for x in request.POST:
                        '''
                            Since the intitial Placement fees were pulled dynamically, 
                            we need to check based on checkboxes being "on" as unchecked boxes do not post.
                        '''
                        if request.POST.get(x) == "on":
                            args["feeId"] = x.replace("idplacement_", "")
                            args["feeAmount"] = request.POST.get(x + "amt")
                            createFee(advertiser, args)
                        '''
                            When placement fees were intially pulled, added a hidden field to keep track
                            of which fees were already chosen. Compare initial values(tracker), against
                            whther or not its corresponding checkbox is "on".
                            If theres a discrepency, ie. Was on, now off, deleteFee                            
                        '''
                        if x.find("pftracker_") > -1:
                            args["feeId"] = x.replace("pftracker_", "")
                            if request.POST.get(x) == "1" and request.POST.get(
                                    "idplacement_" +
                                    str(args["feeId"])) == None:
                                deleteFee(advertiser, args)

            if form != None and form.is_valid():
                if formType == "formContactEdit":
                    if orgContact != None:
                        orgContact.firstname = form.cleaned_data.get(
                            'firstname')
                        orgContact.lastname = form.cleaned_data.get('lastname')
                        orgContact.email = form.cleaned_data.get('email')
                        orgContact.phone = form.cleaned_data.get('phone')
                        orgContact.fax = form.cleaned_data.get('fax')
                        orgContact.save()
                else:
                    form.save()
                    if formType == "form":
                        try:
                            currency_obj = OrganizationCurrency.objects.get(
                                advertiser=advertiser)
                            currency_obj.currency = Currency.objects.get(
                                order=form.cleaned_data.get('currency'))
                            currency_obj.save()
                        except:
                            currency_obj = OrganizationCurrency.objects.create(
                                advertiser=advertiser,
                                currency=Currency.objects.get(
                                    order=form.cleaned_data.get('currency')))

            return HttpResponseRedirect('/network/advertiser/settings/')
        else:
            #print form.errors #this is crashing when  formType == "formIOStatusUpdate":
            return HttpResponseRedirect('/network/advertiser/edit/%d/' %
                                        int(id))

    else:
        #Obtain the Currency used by the advertiser and pass it to the form:
        cur_inits = {}

        cur_obj = OrganizationCurrency.objects.filter(advertiser=advertiser)
        curID = 0
        if cur_obj.count() != 0:
            curID = cur_obj[0].currency.order
        cur_inits = {
            'currency': curID,
        }
        form = NetworkAdvertiserEditForm(instance=advertiser,
                                         initial=cur_inits)

        inits = {}
        if orgContact != None:
            inits = {
                'firstname': orgContact.firstname,
                'lastname': orgContact.lastname,
                'email': orgContact.email,
                'phone': orgContact.phone,
                'fax': orgContact.fax,
            }
        else:
            inits = {
                'firstname': '',
                'lastname': '',
                'email': '',
                'phone': '',
                'fax': '',
            }

        paymentInfo, t = OrganizationPaymentInfo.objects.get_or_create(
            organization=Organization.objects.get(pk=id))
        formContactEdit = NetworkAdvertiserContactEditForm(instance=advertiser,
                                                           initial=inits)
        formBillingEdit = NetworkAdvertiserBillingEditForm(
            instance=paymentInfo)
        formSettingsEdit = NetworkAdvertiserSettingsEditForm(
            instance=advertiser)
        formTermsEdit = ProgramTermSpecialActionForm(instance=special_term)
        if orgIO != None:
            formOrgIOEdit = NetworkAdvertiserOrgIOEditForm(instance=orgIO)
        else:
            formOrgIOEdit = None

        chosenSalesPerson = 0

        if orgIO != None:
            showIOFees = True
            args = {}
            args["ioId"] = orgIO.ace_ioid
            placementFeesList = getFees(advertiser)
            try:
                io = getIO(advertiser, args)
                ioStatus = io['StatusName']
            except:
                ioStatus = "Unavailable"

            if ioStatus != "Pending Sales Approval":
                ioStatus = False

            if orgIO.salesrep != None and orgIO.salesrep != 0:
                chosenSalesPerson = orgIO.salesrep

        else:
            showIOFees = False
            placementFeesList = None
            ioStatus = False

    return AQ_render_to_response(
        request,
        'network/advertiser-edit.html',
        {
            'advertiser': advertiser,
            'form': form,
            'formContactEdit': formContactEdit,
            'formBillingEdit': formBillingEdit,
            'formTermsEdit': formTermsEdit,
            'formSettingsEdit': formSettingsEdit,
            'formOrgIOEdit': formOrgIOEdit,
            'placementFeesList': placementFeesList,
            'showIOFees': showIOFees,
            'SalesPersonList': client.getSalesPersonList(),
            'chosenSalesPerson': chosenSalesPerson,
            #'arrIOs' : searchIOs(),
            'ioStatus': ioStatus,
        },
        context_instance=RequestContext(request))
Exemplo n.º 4
0
def network_account_advertiser_applications_create(request, id=None):
    ''' View to allow Network Admins the ability to create a new Advertiser Organization
        using their AdvertiserApplication as a base template.  This view creates the
        initial User login as well. '''
    from atrinsic.base.models import AdvertiserApplication,Currency,Organization,UserProfile,User,OrganizationContacts,OrganizationPaymentInfo,OrganizationCurrency
    from forms import NetworkAdvertiserEditForm,UserForm
    application = get_object_or_404(AdvertiserApplication, id=id)
    application.company_name = application.organization_name

    if request.method == 'POST':
        form = NetworkAdvertiserEditForm(request.POST)
        user_form = UserForm(request.POST)

        if form.is_valid() and user_form.is_valid():
            if form.cleaned_data["country"] == "CA":
                form.cleaned_data["state"] = form.cleaned_data['province']
            del form.cleaned_data['province']
            del form.cleaned_data['salesperson']
            
            curID = form.cleaned_data['currency']
            del form.cleaned_data['currency']
            org = Organization.objects.create(org_type = ORGTYPE_ADVERTISER, status = ORGSTATUS_TEST, **form.cleaned_data)
            org.save()

            orgCur = OrganizationCurrency.objects.create(advertiser = org, currency = Currency.objects.get(order=curID))
            
            u = User.objects.create(username=user_form.cleaned_data['email'], email=user_form.cleaned_data['email'],
                        first_name=user_form.cleaned_data['first_name'], last_name=user_form.cleaned_data['last_name'])

            u.set_password(user_form.cleaned_data['password'])
            u.save()

            up = UserProfile.objects.create(user=u)
            up.organizations.add(org)
            up.save()

            del form.cleaned_data['show_alias']
            del form.cleaned_data['company_name']
            del form.cleaned_data['company_alias']
            del form.cleaned_data['ticker']
            del form.cleaned_data['is_private']
            del form.cleaned_data['ticker_symbol']
            del form.cleaned_data['vertical']
            del form.cleaned_data['brandlock_key']
            del form.cleaned_data['brandlock']
            
            org_contacts = OrganizationContacts.objects.create(organization=org,firstname=application.contact_firstname, lastname=application.contact_lastname,email=application.contact_email,phone=application.contact_phone,fax=application.contact_fax)
            org_contacts.save()
            
            orgPayeeInfo = OrganizationPaymentInfo(organization=org)
            orgPayeeInfo.save()
            
            # Assign all ADMINLEVEL_ADMINISTRATOR to this
            for up in UserProfile.objects.filter(admin_level=ADMINLEVEL_ADMINISTRATOR):
                up.admin_assigned_organizations.add(org)
                up.save()


            application.delete()
            
            #ACE INSERT IF NO MATCHES ARE FOUND
            matches = search_company(application.organization_name)
            if len(matches) > 0:
                #redirect to new url and template to display list. Chose or create
                return AQ_render_to_response(request, 'network/search-ace.html', {'matches':matches,'orgId':org.id}, context_instance=RequestContext(request))         
            else:
                create_company(org)
                
            #args = {}
            #args["salesrep"] = form.cleaned_data['salesperson']
            #createIO(advertiser, args)
            
            
                                                
            return HttpResponseRedirect('/network/account/advertiser/applications/')
    else:
        #form = OrganizationForm(initial=application.__dict__)
        form = NetworkAdvertiserEditForm(initial=application.__dict__)
        user_form = UserForm(initial= {
                            'first_name' : application.contact_firstname,
                            'last_name' : application.contact_lastname,
                            'email' : application.contact_email,
                        })

    return AQ_render_to_response(request, 'network/advertiser-applications-create.html', {
            'application' : application,
            'form' : form,
            'user_form' :  user_form,
        }, context_instance=RequestContext(request))
Exemplo n.º 5
0
def network_account_advertiser_applications_create(request, id=None):
    ''' View to allow Network Admins the ability to create a new Advertiser Organization
        using their AdvertiserApplication as a base template.  This view creates the
        initial User login as well. '''
    from atrinsic.base.models import AdvertiserApplication, Currency, Organization, UserProfile, User, OrganizationContacts, OrganizationPaymentInfo, OrganizationCurrency
    from forms import NetworkAdvertiserEditForm, UserForm
    application = get_object_or_404(AdvertiserApplication, id=id)
    application.company_name = application.organization_name

    if request.method == 'POST':
        form = NetworkAdvertiserEditForm(request.POST)
        user_form = UserForm(request.POST)

        if form.is_valid() and user_form.is_valid():
            if form.cleaned_data["country"] == "CA":
                form.cleaned_data["state"] = form.cleaned_data['province']
            del form.cleaned_data['province']
            del form.cleaned_data['salesperson']

            curID = form.cleaned_data['currency']
            del form.cleaned_data['currency']
            org = Organization.objects.create(org_type=ORGTYPE_ADVERTISER,
                                              status=ORGSTATUS_TEST,
                                              **form.cleaned_data)
            org.save()

            orgCur = OrganizationCurrency.objects.create(
                advertiser=org, currency=Currency.objects.get(order=curID))

            u = User.objects.create(
                username=user_form.cleaned_data['email'],
                email=user_form.cleaned_data['email'],
                first_name=user_form.cleaned_data['first_name'],
                last_name=user_form.cleaned_data['last_name'])

            u.set_password(user_form.cleaned_data['password'])
            u.save()

            up = UserProfile.objects.create(user=u)
            up.organizations.add(org)
            up.save()

            del form.cleaned_data['show_alias']
            del form.cleaned_data['company_name']
            del form.cleaned_data['company_alias']
            del form.cleaned_data['ticker']
            del form.cleaned_data['is_private']
            del form.cleaned_data['ticker_symbol']
            del form.cleaned_data['vertical']
            del form.cleaned_data['brandlock_key']
            del form.cleaned_data['brandlock']

            org_contacts = OrganizationContacts.objects.create(
                organization=org,
                firstname=application.contact_firstname,
                lastname=application.contact_lastname,
                email=application.contact_email,
                phone=application.contact_phone,
                fax=application.contact_fax)
            org_contacts.save()

            orgPayeeInfo = OrganizationPaymentInfo(organization=org)
            orgPayeeInfo.save()

            # Assign all ADMINLEVEL_ADMINISTRATOR to this
            for up in UserProfile.objects.filter(
                    admin_level=ADMINLEVEL_ADMINISTRATOR):
                up.admin_assigned_organizations.add(org)
                up.save()

            application.delete()

            #ACE INSERT IF NO MATCHES ARE FOUND
            matches = search_company(application.organization_name)
            if len(matches) > 0:
                #redirect to new url and template to display list. Chose or create
                return AQ_render_to_response(
                    request,
                    'network/search-ace.html', {
                        'matches': matches,
                        'orgId': org.id
                    },
                    context_instance=RequestContext(request))
            else:
                create_company(org)

            #args = {}
            #args["salesrep"] = form.cleaned_data['salesperson']
            #createIO(advertiser, args)

            return HttpResponseRedirect(
                '/network/account/advertiser/applications/')
    else:
        #form = OrganizationForm(initial=application.__dict__)
        form = NetworkAdvertiserEditForm(initial=application.__dict__)
        user_form = UserForm(
            initial={
                'first_name': application.contact_firstname,
                'last_name': application.contact_lastname,
                'email': application.contact_email,
            })

    return AQ_render_to_response(request,
                                 'network/advertiser-applications-create.html',
                                 {
                                     'application': application,
                                     'form': form,
                                     'user_form': user_form,
                                 },
                                 context_instance=RequestContext(request))
Exemplo n.º 6
0
def network_advertiser_edit(request, id):
    ''' View to allow a Network Admin to edit and update an Advertiser's
        Organization Information '''    
    from atrinsic.base.models import ProgramTermSpecialAction,OrganizationContacts, Organization_IO, OrganizationPaymentInfo, Organization, OrganizationCurrency, Currency
    from atrinsic.util.AceFieldLists import Ace
    from forms import NetworkAdvertiserEditForm,NetworkAdvertiserContactEditForm,NetworkAdvertiserOrgIOEditForm,NetworkAdvertiserBillingEditForm,NetworkAdvertiserSettingsEditForm,ProgramTermSpecialActionForm
    advertiser = get_object_or_404(request.user.get_profile().admin_assigned_advertisers(), id=id)
    
    try:
        orgContact = OrganizationContacts.objects.get(organization=advertiser)
    except:
        orgContact = None
    try:
        orgIO = Organization_IO.objects.get(organization=advertiser)
    except:
        orgIO = None
    
    client = Ace()
    form = None
    
    special_term,x = ProgramTermSpecialAction.objects.get_or_create(organization = advertiser)
        
    if request.method == 'POST':
        if request.POST.get("formtype",None):
            formType = request.POST.get("formtype")
            if formType == "form":
                form = NetworkAdvertiserEditForm(request.POST, request.FILES, instance=advertiser)
            elif formType == "formContactEdit":
                form = NetworkAdvertiserContactEditForm(request.POST, instance=OrganizationContacts.objects.get(organization=advertiser))
            elif formType == "formBillingEdit":
                form = NetworkAdvertiserBillingEditForm(request.POST, instance=OrganizationPaymentInfo.objects.get(organization=advertiser))
            elif formType == "formSettingsEdit":
                form = NetworkAdvertiserSettingsEditForm(request.POST, instance=advertiser)
            elif formType == "formTermsEdit":
                form = ProgramTermSpecialActionForm(request.POST, instance=special_term)
            elif formType == "formIOStatusUpdate":
                form = None
                if orgIO != None:
                    args = {}
                    args["ioId"] = orgIO.ace_ioid  
                    args["statusId"] = APPROVED_BY_SALES_MANAGER  
                    args["spId"] = request.POST.get("salesperson")  
                    updateIOStatus(advertiser,args)
            elif formType == "formIOFeeSettingsEdit":  
                form = NetworkAdvertiserOrgIOEditForm(request.POST, instance=advertiser)
                if orgIO != None:
                    if form.is_valid():
                        orgIO.transaction_fee_type = request.POST.get("transaction_fee_type")
                        orgIO.transaction_fee_amount = request.POST.get("transaction_fee_amount")
                        orgIO.save()
                    else:
                        return HttpResponseRedirect('/network/advertiser/edit/%d/?error=1' % int(id))
                        
                    form = None
                    
                    if orgIO.salesrep == 0 or orgIO.salesrep == None:
                        orgIO.salesrep = request.POST.get("salesperson")
                        orgIO.save()
                    args = {}
                    args["ioId"] = orgIO.ace_ioid  
                    args["spId"] = request.POST.get("salesperson")  
                    for x in request.POST:
                        '''
                            Since the intitial Placement fees were pulled dynamically, 
                            we need to check based on checkboxes being "on" as unchecked boxes do not post.
                        '''
                        if request.POST.get(x) == "on":
                            args["feeId"] = x.replace("idplacement_", "")
                            args["feeAmount"] = request.POST.get(x + "amt")
                            createFee(advertiser,args)
                        
                        '''
                            When placement fees were intially pulled, added a hidden field to keep track
                            of which fees were already chosen. Compare initial values(tracker), against
                            whther or not its corresponding checkbox is "on".
                            If theres a discrepency, ie. Was on, now off, deleteFee                            
                        '''
                        if x.find("pftracker_") > -1:
                            args["feeId"] = x.replace("pftracker_", "")
                            if request.POST.get(x) == "1" and request.POST.get("idplacement_" + str(args["feeId"])) == None:
                                deleteFee(advertiser,args)
            
            if form != None and form.is_valid():
                if formType == "formContactEdit":
                    if orgContact != None:
                        orgContact.firstname = form.cleaned_data.get('firstname')
                        orgContact.lastname = form.cleaned_data.get('lastname')
                        orgContact.email = form.cleaned_data.get('email')
                        orgContact.phone = form.cleaned_data.get('phone') 
                        orgContact.fax =  form.cleaned_data.get('fax')
                        orgContact.save()
                else:
                    form.save()
                    if formType == "form":
                        try:
                            currency_obj = OrganizationCurrency.objects.get(advertiser = advertiser)
                            currency_obj.currency = Currency.objects.get(order=form.cleaned_data.get('currency'))
                            currency_obj.save()
                        except:
                            currency_obj = OrganizationCurrency.objects.create(advertiser=advertiser, currency = Currency.objects.get(order=form.cleaned_data.get('currency')))
               
            return HttpResponseRedirect('/network/advertiser/settings/')
        else:
            #print form.errors #this is crashing when  formType == "formIOStatusUpdate":
            return HttpResponseRedirect('/network/advertiser/edit/%d/' % int(id))
        
    else:
        #Obtain the Currency used by the advertiser and pass it to the form:
        cur_inits = {}
        
        cur_obj = OrganizationCurrency.objects.filter(advertiser=advertiser)
        curID = 0
        if cur_obj.count() != 0:
            curID = cur_obj[0].currency.order    		
        cur_inits = {'currency':curID,}
        form = NetworkAdvertiserEditForm(instance=advertiser,initial=cur_inits)
        
        inits = {}
        if orgContact != None:
            inits = {'firstname':orgContact.firstname, 
                     'lastname':orgContact.lastname,
                     'email':orgContact.email, 
                     'phone':orgContact.phone, 
                     'fax':orgContact.fax,}
        else:
            inits = {'firstname':'', 
                     'lastname':'',
                     'email':'', 
                     'phone':'', 
                     'fax':'',}
        
        paymentInfo,t = OrganizationPaymentInfo.objects.get_or_create(organization = Organization.objects.get(pk=id))
        formContactEdit = NetworkAdvertiserContactEditForm(instance=advertiser,initial=inits)
        formBillingEdit = NetworkAdvertiserBillingEditForm(instance=paymentInfo)
        formSettingsEdit = NetworkAdvertiserSettingsEditForm(instance=advertiser)
        formTermsEdit = ProgramTermSpecialActionForm(instance=special_term)
        if orgIO != None:
            formOrgIOEdit = NetworkAdvertiserOrgIOEditForm(instance=orgIO)
        else:
            formOrgIOEdit = None
            
        chosenSalesPerson = 0

        if orgIO != None:
            showIOFees = True
            args = {}
            args["ioId"] = orgIO.ace_ioid            
            placementFeesList = getFees(advertiser)
            try:
                io = getIO(advertiser,args)
                ioStatus = io['StatusName']
            except:
                ioStatus = "Unavailable"
                
            if ioStatus != "Pending Sales Approval":
                ioStatus = False
            
            if orgIO.salesrep != None and orgIO.salesrep != 0:
                chosenSalesPerson = orgIO.salesrep           
            
        else:
            showIOFees = False
            placementFeesList = None
            ioStatus = False        
    
    return AQ_render_to_response(request, 'network/advertiser-edit.html', {
            'advertiser' : advertiser,
            'form' : form,
            'formContactEdit' : formContactEdit,
            'formBillingEdit' : formBillingEdit,
            'formTermsEdit' : formTermsEdit,
            'formSettingsEdit' : formSettingsEdit,
            'formOrgIOEdit' : formOrgIOEdit,
            'placementFeesList' : placementFeesList,
            'showIOFees' : showIOFees,
            'SalesPersonList' : client.getSalesPersonList(),
            'chosenSalesPerson' : chosenSalesPerson,
            #'arrIOs' : searchIOs(),
            'ioStatus' : ioStatus,
        }, context_instance=RequestContext(request))