def create_project_detail(user, p_detail): """ 创建项目 完全版 by:尚宗凯 at:2015-3-17 :param user: :param kwargs: :return: """ project = Project() project.name = p_detail['name'] project.total_name = p_detail['total_name'] project.address = p_detail['address'] project.jzmj = p_detail['jzmj'] project.jglx = p_detail['jglx'] project.jzcs = p_detail['jzcs'] project.htzj = p_detail['htzj'] project.kg_date = p_detail['kg_date'] project.days = p_detail['days'] # project.jsdw = u'建设单位%s' % user.tel # project.jsdw_fzr = u'负责人%s' % user.tel[-1:] # project.kcdw = u'勘察单位%s' % user.tel[-1:] # project.kcdw_fzr = u'勘察%s' % user.tel[-1:] # project.sjdw = u'设计单位%s' % user.tel[-1:] # project.sjdw_fzr = u'设计%s' % user.tel[-1:] # project.sgdw = u'施工单位%s' % user.tel[-1:] # project.sgdw_fzr = u'施工%s' % user.tel[-1:] # project.jldw = u'监理单位%s' % user.tel[-1:] # project.jldw_fzr = u'监理%s' % user.tel[-1:] project.jsdw = p_detail['jsdw'] project.jsdw_fzr = p_detail['jsdw_fzr'] project.kcdw = p_detail['kcdw'] project.kcdw_fzr = p_detail['kcdw_fzr'] project.sjdw = p_detail['sjdw'] project.sjdw_fzr = p_detail['sjdw_fzr'] project.sgdw = p_detail['sgdw'] project.sgdw_fzr = p_detail['sgdw_fzr'] project.jldw = p_detail['jldw'] project.jldw_fzr = p_detail['jldw_fzr'] project.manager = user project.save() person = Person() person.user = user project.manager = user project.save() rootgroup = Group() rootgroup.user = user rootgroup.name = project.total_name rootgroup.type = 'root' rootgroup.project = project rootgroup.save() person.project = project person.save() rootgroup.say_members.add(person.user) group = Group() group.name = u'管理员' group.type = 'sys_manage' group.project = project group.sorted = 0 group.save() group.say_members.add(person.user) group = Group() group.name = u'行政主管' group.type = 'sys_xzzg' group.project = project group.sorted = 1 group.save() group = Group() group.name = u'建设单位' group.type = 'sys_jsdw' group.project = project group.sorted = 2 group.save() group = Group() group.name = u'设计单位' group.type = 'sys_sjdw' group.project = project group.sorted = 3 group.save() group = Group() group.name = u'勘察单位' group.type = 'sys_kcdw' group.project = project group.sorted = 4 group.save() group = Group() group.name = u'监理单位' group.type = 'sys_jldw' group.project = project group.sorted = 5 group.save() group = Group() group.name = u'施工单位' group.type = 'sys_sgdw' group.project = project group.sorted = 6 group.save() group = Group() group.name = u'项目经理部' group.type = 'sys_xmjl' group.project = project group.sorted = 7 group.is_needhx = True group.save() group.say_members.add(person.user) group = Group() group.name = u'劳务分包单位' group.type = 'sys_lwfbdw' group.project = project group.sorted = 8 group.save() group = Group() group.name = u'专业分包单位' group.type = 'sys_zyfbdw' group.project = project group.sorted = 9 group.save() group = Group() group.name = u'社会大众通道' group.type = 'sys_shdztd' group.project = project group.sorted = 1000 group.save() return project
def create_project(user, name, totalname): """ 创建项目 by:王健 at:2015-1-21 恢复total_name 字段 by:王健 at:2015-2-2 分组排序字段修改 by:王健 at:2015-2-3 创建项目 基础信息,增加社会大众通道 by:王健 at:2015-2-16 增加环信群组的属性 by:王健 at:2015-2-27 修改负责人长度 by:王健 at:2015-3-5 添加默认 地址 by:王健 at:2015-3-9 指定超级管理员 by:王健 at:2015-3-16 优化初始创建群聊 by:王健 at:2015-3-20 取消社会大众 分组 by:王健 at:2015-4-9 :param user: :return: """ project = Project() project.name = name project.total_name = totalname project.address = 101030100 project.jzmj = 50000 project.jglx = u'钢筋' project.jzcs = 3 project.htzj = 455732183 project.kg_date = '2015-01-10' project.days = 433 project.jsdw = u'建设单位%s' % user.tel project.jsdw_fzr = u'负责人%s' % user.tel[-1:] project.kcdw = u'勘察单位%s' % user.tel[-1:] project.kcdw_fzr = u'勘察%s' % user.tel[-1:] project.sjdw = u'设计单位%s' % user.tel[-1:] project.sjdw_fzr = u'设计%s' % user.tel[-1:] project.sgdw = u'施工单位%s' % user.tel[-1:] project.sgdw_fzr = u'施工%s' % user.tel[-1:] project.jldw = u'监理单位%s' % user.tel[-1:] project.jldw_fzr = u'监理%s' % user.tel[-1:] project.manager = user project.save() person = Person() person.user = user project.manager = user project.save() rootgroup = Group() rootgroup.user = user rootgroup.name = project.total_name rootgroup.type = 'root' rootgroup.project = project rootgroup.save() person.project = project person.save() rootgroup.say_members.add(person.user) group = Group() group.name = u'管理员' group.type = 'sys_manage' group.project = project group.sorted = 0 group.save() group.say_members.add(person.user) group = Group() group.name = u'行政主管' group.type = 'sys_xzzg' group.project = project group.sorted = 1 group.save() group = Group() group.name = u'建设单位' group.type = 'sys_jsdw' group.project = project group.sorted = 2 group.save() group = Group() group.name = u'设计单位' group.type = 'sys_sjdw' group.project = project group.sorted = 3 group.save() group = Group() group.name = u'勘察单位' group.type = 'sys_kcdw' group.project = project group.sorted = 4 group.save() group = Group() group.name = u'监理单位' group.type = 'sys_jldw' group.project = project group.sorted = 5 group.save() group = Group() group.name = u'施工单位' group.type = 'sys_sgdw' group.project = project group.sorted = 6 group.save() group = Group() group.name = u'项目经理部' group.type = 'sys_xmjl' group.project = project group.sorted = 7 group.is_needhx = True group.save() group.say_members.add(person.user) group.save() group = Group() group.name = u'劳务分包单位' group.type = 'sys_lwfbdw' group.project = project group.sorted = 8 group.save() group = Group() group.name = u'专业分包单位' group.type = 'sys_zyfbdw' group.project = project group.sorted = 9 group.save() # group = Group() # group.name = u'社会大众通道' # group.type = 'sys_shdztd' # group.project = project # group.sorted = 1000 # group.save() return project