Пример #1
0
    def _save_potential(self, user=None, contact=None, potential=None):
        if contact['id'] is None or '' == contact['id']:
            c = Contact()
        else:
            c = Contact.objects.get(id=contact['id'])
        c.name = contact['name']
        c.title = contact['title']
        c.tel = contact['tel']
        c.mobile = contact['mobile']
        c.idCard = contact['idCard']
        c.email = contact['email']
        c.idCopy = contact['idCopy']
        # print(c.__dict__)
        c.save()

        if potential['id'] is None or '' == potential['id']:
            p = Potential()
        else:
            p = Potential.objects.get(id=potential['id'])
        p.zh_name = potential['zh_name']
        p.en_name = potential['en_name']
        p.ceo = potential['ceo']
        p.scope = potential['scope']
        p.founding = potential['founding']
        p.capital = potential['capital']
        p.licence = potential['licence']
        p.licenceCopy = potential['licenceCopy']
        p.tax = potential['tax']
        p.taxCopy = potential['taxCopy']
        p.orgCode = potential['orgCode']
        p.orgCodeCopy = potential['orgCodeCopy']
        p.employees = potential['employees']
        p.address = potential['address']
        p.homepage = potential['homepage']
        p.tel = potential['tel']
        p.fax = potential['fax']
        p.post = potential['post']
        p.summary = potential['summary']
        p.is_active = False
        p.contact = c
        p.user = user
        # print(p.__dict__)
        p.save()

        return p
Пример #2
0
def fill_in(request):
    input = utils.load_json(request)
    # contact = input['contact']
    # potential = input['potential']
    user_id = input['user_id']
    process_id = input['process_id']

    user = User.objects.get(id=user_id)
    if user is None:
        return JsonResponse({'error':r'尚未进行用户注册'})

    # process = PotentialApprovalProcess.objects.get(id=process_id)

    if False:
        c = Contact()
        c.name = 'contact_01'
        c.title = 'no title'
        c.tel = '110'
        c.mobile = '13800138000'
        c.idCard = 'mei you'
        c.email = '*****@*****.**'
        c.idCopy = 'ye mei you'
        # c.name = contact.name
        # c.title = contact.title
        # c.tel = contact.tel
        # c.mobile = contact.mobile
        # c.idCard = contact.idCard
        # c.email = contact.email
        # c.idCopy = contact.idCopy
        # print(utils.to_json(c))
        print(c.__dict__)
        # c.save()


        p = Potential()
        p.zh_name = u'供应商_01'
        p.en_name = 'partner_01'
        p.ceo = 'Whoever'
        p.scope = 'what?'
        p.founding = datetime.datetime.today()
        p.capital = 100000000000
        p.licence = '0101010101010'
        p.licenceCopy = 'mei you'
        p.tax = 'mei you'
        p.taxCopy = 'ye mei you'
        p.orgCode = '250'
        p.orgCodeCopy = 'mei you'
        p.employees = 3
        p.address = r'beijing'
        p.homepage = r'www.bjhjyd.gov.cn'
        p.tel = '62620202'
        p.fax = '66668888'
        p.post = u'北京市630信箱'
        p.summary = 'blahblahblah....'
        # p.zh_name = potential.zh_name
        # p.en_name = potential.en_name
        # p.ceo = potential.ceo
        # p.scope = potential.scope
        # p.founding = potential.founding
        # p.capital = potential.capital
        # p.licence = potential.license
        # p.licenceCopy = potential.licenceCopy
        # p.tax = potential.tax
        # p.taxCopy = potential.taxCopy
        # p.orgCode = potential.orgCode
        # p.orgCodeCopy = potential.orgCodeCopy
        # p.employees = potential.employees
        # p.address = potential.address
        # p.homepage = potential.homepage
        # p.tel = potential.tel
        # p.fax = potential.fax
        # p.post = potential.post
        # p.summary = potential.summary
        # p.contact = c
        p.user = user
        # print(utils.to_json(p))
        print(p.__dict__)
        # p.save()

        # RegistryApprovalFlow.fill_in.run()
        return JsonResponse({'contact':c.id, 'potential':p.id})