def applymodify(request, curppid="0"): lstauth = [0,1] if int(request.user.unitgroup) not in lstauth: return render_to_response('noauth.html') if curppid == "0": return HttpResponseRedirect('/applylist/') # 如果还没有申请,则不存在修改的问题,直接跳转到申请列表 # 只能修改未经批准的申请 try: curpp = ApprovalModel.objects.get(approvalsn__isnull=True, mental__id=curppid) except ApprovalModel.DoesNotExist: return HttpResponseRedirect('/applylist/') nomodifyinfo = [u"申请人姓名:%s" % curpp.mental.name, \ u"身份证号:%s" % curpp.mental.ppid, u"经济状况:%s" % curpp.mental.economic,] today = datetime.date.today() jscal_min = int(today.isoformat().replace('-', '')) jscal_max = int((today + datetime.timedelta(30)).isoformat().replace('-', '')) curpp.applyman = request.user.operatorname form = ApplyForm(instance=curpp) if request.method == "POST": form = ApplyForm(request.POST, instance=curpp) # this can modify the current form if form.is_valid(): form.save() return applylist(request, curpp.mental.name, curpp.mental.ppid) return render_to_response('applymodify.html', {"form":form, "nomodifyinfo":nomodifyinfo, "jscal_min":jscal_min, "jscal_max":jscal_max}, context_instance=RequestContext(request))
def applyinput(request, curppid="111456789000"): '''申请求助视图''' lstauth = [ 0, 1, ] if int(request.user.unitgroup) not in lstauth: return render_to_response('noauth.html') if curppid == "": return HttpResponseRedirect('/applylist/') # 如果已经申请,则跳转 try: ApprovalModel.objects.get(approvalsn__isnull=True, mental__ppid=curppid) return HttpResponseRedirect('/applylist/') except ApprovalModel.DoesNotExist: pass # 如果原信息总表中不存在,则跳转 try: curpp = MentalModel.objects.get(ppid=curppid) except MentalModel.DoesNotExist: return HttpResponseRedirect('/applylist/') nomodifyinfo = [u"姓名:%s" % curpp.name, u"身份证号:%s" % curpp.ppid] today = datetime.date.today() jscal_min = int(today.isoformat().replace('-', '')) jscal_max = int( (today + datetime.timedelta(30)).isoformat().replace('-', '')) # form = ApplyForm(instance=curpp) form = ApplyForm(initial={ 'mental': curpp, 'applyman': request.user.operatorname }) # print form if request.method == "POST": form = ApplyForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/applylist/') # Redirect return render_to_response('applyinput.html', { "form": form, "nomodifyinfo": nomodifyinfo, "jscal_min": jscal_min, "jscal_max": jscal_max }, context_instance=RequestContext(request))
def _process_cv(request,opening): applyform = ApplyForm() if request.method == "POST": form= ApplyForm(request.POST) if form.is_valid(): vacante=form.save(commit=False) vacante.save() return direct_to_template(request, template = "vacancy/job_submit_success.html") else: return direct_to_template(request, template = "vacancy/job_form.html")
def applymodify(request, curppid="0"): lstauth = [0, 1] if int(request.user.unitgroup) not in lstauth: return render_to_response('noauth.html') if curppid == "0": return HttpResponseRedirect('/applylist/') # 如果还没有申请,则不存在修改的问题,直接跳转到申请列表 # 只能修改未经批准的申请 try: curpp = ApprovalModel.objects.get(approvalsn__isnull=True, mental__id=curppid) except ApprovalModel.DoesNotExist: return HttpResponseRedirect('/applylist/') nomodifyinfo = [u"申请人姓名:%s" % curpp.mental.name, \ u"身份证号:%s" % curpp.mental.ppid, u"经济状况:%s" % curpp.mental.economic,] today = datetime.date.today() jscal_min = int(today.isoformat().replace('-', '')) jscal_max = int( (today + datetime.timedelta(30)).isoformat().replace('-', '')) curpp.applyman = request.user.operatorname form = ApplyForm(instance=curpp) if request.method == "POST": form = ApplyForm(request.POST, instance=curpp) # this can modify the current form if form.is_valid(): form.save() return applylist(request, curpp.mental.name, curpp.mental.ppid) return render_to_response('applymodify.html', { "form": form, "nomodifyinfo": nomodifyinfo, "jscal_min": jscal_min, "jscal_max": jscal_max }, context_instance=RequestContext(request))
def applyinput(request, curppid="111456789000"): '''申请求助视图''' lstauth = [0,1,] if int(request.user.unitgroup) not in lstauth: return render_to_response('noauth.html') if curppid == "": return HttpResponseRedirect('/applylist/') # 如果已经申请,则跳转 try: ApprovalModel.objects.get(approvalsn__isnull=True, mental__ppid=curppid) return HttpResponseRedirect('/applylist/') except ApprovalModel.DoesNotExist: pass # 如果原信息总表中不存在,则跳转 try: curpp = MentalModel.objects.get(ppid=curppid) except MentalModel.DoesNotExist: return HttpResponseRedirect('/applylist/') nomodifyinfo = [u"姓名:%s" % curpp.name, u"身份证号:%s" % curpp.ppid] today = datetime.date.today() jscal_min = int(today.isoformat().replace('-', '')) jscal_max = int((today + datetime.timedelta(30)).isoformat().replace('-', '')) # form = ApplyForm(instance=curpp) form = ApplyForm(initial={'mental':curpp, 'applyman':request.user.operatorname}) # print form if request.method == "POST": form = ApplyForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/applylist/') # Redirect return render_to_response('applyinput.html', {"form":form, "nomodifyinfo":nomodifyinfo,"jscal_min":jscal_min, "jscal_max":jscal_max}, context_instance=RequestContext(request))