Exemple #1
0
 def __createStatusRecord():
     """
                             创建表单状态流转记录 由于每一次改变表单状态都需要创建这么一条记录 所以 写成函数会方便很多
 
     """
     user = userService.getUser(request)
     
     status = FormStatus(status=form.status)
     status.status_user = user
     status.status_da = form
     status.createTime = datetime.datetime.now()
     if(request.POST and request.POST.get("comment")):
         status.statusDes = request.POST.get("comment")
         
     status.save()
Exemple #2
0
def addDomainMappingForm(Id,mapping,root):
    """
                    将申请单 域名映射部分存入数据库

      Id: 该域名映射对应的申请单ID
      mapping:域名映射数据
      root:域名映射对应的父域名
      
    """
  
    main = get_object_or_404(DomainApplication,id=Id)
    main.status = staticVar.WAITINGFORVERIFY
    main.save()

    #创建一条标记表单状态流转的记录
    status = FormStatus(status=staticVar.WAITINGFORVERIFY)
    status.status_user = main.creater
    status.status_da = main
    status.createTime = datetime.datetime.now()
    status.save()
    
    domainName = mapping.values()[0]
    try:                                                       #如果域名存在 则查出来 没有就创建一条新的  这里创建的是  Type=1的域名
        domain1 = DomainForm.objects.get(domainName=domainName,domainType=1)
        
    except DomainForm.DoesNotExist:
        domain1 = DomainForm(domainName=domainName,domainType=1)
    
    domain1.domain_zone = Zone.objects.get(zoneName=root)
    domain1.status = staticVar.CANNOT_APPLY
    domain1.save()
    
    domain = DomainForm(domainName=domainName,domainType=0)
    domain.domain_zone =  Zone.objects.get(zoneName=root)
    domain.status = staticVar.CANNOT_APPLY        
    domain.save()
    domain.da_domain.add(main)
    domain.save()
    
    mappingData = mapping.values()[1]                      #将ip mode sp 这样的映射关系存入数据库
    for m in mappingData:
        domainMapping = DomainMapping(mode=m.get("mode"),aim= m.get("aim"))
        domainMapping.dm_domain = domain
        domainMapping.dm_sp = ServiceProvider.objects.get(spName=m.get("spName"))
        domainMapping.save()
Exemple #3
0
def addMainForm(request,main_part):
    """
                   将表单的主要信息存入数据库中    返回存入后的id

     main_part: 是申请表单主要信息的form
    
    """
    main = main_part.save(commit=False)
    main.creater = userService.getUser(request)
    main.createTime = datetime.datetime.now()
    main.status = staticVar.CREATED
    main.save()

    #创建一条标记表单状态流转的记录
    status = FormStatus(status=staticVar.CREATED)
    status.status_user = userService.getUser(request)
    status.status_da = main
    status.createTime = datetime.datetime.now()
    status.save()
    
    return main.id