def createView(request): if request.method == "POST": creationForm = ProjectCreationForm(request.POST) if creationForm.is_valid(): title = creationForm.cleaned_data["title"] special = creationForm.cleaned_data["special"] teacher = TeacherProfile.objects.get(userid = request.user) createNewProject(teacher, title, special) return HttpResponseRedirect(reverse("teacher.views.homeView")) else: pass
def CreateProject(request, form): createform = ProjectCreationTeacherForm(deserialize_form(form)) if createform.is_valid(): title = createform.cleaned_data["title"].strip() teacher_id = createform.cleaned_data["teacher"] special = createform.cleaned_data["special"] try: teacher = TeacherProfile.objects.get(userid__id=teacher_id) createNewProject(teacher, title, special) return simplejson.dumps({'status':'1', "message": u"项目创建成功"}) except: return simplejson.dumps({'status':'0', "message": u"项目创建失败"}) else: return simplejson.dumps({'status':'0', "message": u"项目创建失败"})
def CreateProject(request, form): createform = ProjectCreationTeacherForm(deserialize_form(form)) if createform.is_valid(): title = createform.cleaned_data["title"].strip() teacher_id = createform.cleaned_data["teacher"] special = createform.cleaned_data["special"] try: teacher = TeacherProfile.objects.get(userid__id=teacher_id) createNewProject(teacher, title, special) return simplejson.dumps({'status': '1', "message": u"项目创建成功"}) except: return simplejson.dumps({'status': '0', "message": u"项目创建失败"}) else: return simplejson.dumps({'status': '0', "message": u"项目创建失败"})
print Special.objects.get(name = row[10]) college=College.objects.get(name= row[16]) sendemail('1',row[14],row[14][-6:],row[15],TEACHER_USER,row[13],send_email = False,college=college.id) teacher= TeacherProfile.objects.get(userid__username = row[14]) teacherInfoSettingObj = TeacherInfoSetting.objects.get(teacher = teacher.id) # teacherInfoSettingObj.sex = SEX_DICTS[row[4]] # teacherInfoSettingObj.birth = row[5] # teacherInfoSettingObj.base_name = row[11] # teacherInfoSettingObj.target_type = PROJECT_IDENTITY_DICTS[row[6]] # teacherInfoSettingObj.degree = DEGREE_DICTS[row[7]] # teacherInfoSettingObj.title = PROFESSIONAL_TITLE_DICTS[row[8]] # teacherInfoSettingObj.base_type = RESEARCH_BASES_TYPE_DICTS[row[10]] # teacherInfoSettingObj.position = EXECUTIVE_POSITION_DICTS[row[9]] teacherInfoSettingObj.save() special = Special.objects.get(name = row[10]) project = createNewProject(teacher,row[0],special.id) # project.project_status =row[9] # project.project_tpye = row[10] project.project_code = unicode(row[1]) project.project_budget_max = float(row[11])*10000 project.project_status = ProjectStatus.objects.get(status = PROJECT_STATUS_APPROVAL) # if int(int(row[20])) <=2013: # # else: # project.project_status = ProjectStatus.objects.get(status = PROJECT_STATUS_TASK_SCHOOL_OVER) # project.application_year = 2014 project.approval_year = 2015 project.start_time = datetime.datetime.strptime(row[6],"%Y%m") project.end_time = datetime.datetime.strptime(row[7],"%Y%m") # project.science_type = ScienceActivityType.objects.get(category = SCIENCE_ACTIVITY_TYPE_DICTS[row[15]]) # project.trade_code = NationalTradeCode.objects.get(category = NATIONAL_TRADE_CODE_DICTS[row[16]])