Ejemplo n.º 1
0
def uploadfile(request):
  if request.method == "POST":
    uf = UploadForm(request.POST,request.FILES)
    if uf.is_valid():
      contestID = uf.cleaned_data['contestID']
      xlsAddr = uf.cleaned_data['xlsAddr']
      cx = ContestXls()
      cx.contestID = contestID
      cx.xlsAddr = xlsAddr
      cx.save()
      return HttpResponse('upload ok!')
  else:
    uf = UploadForm()
  return render(request, 'cugbacm/uploadfile.html',{'uf':uf})
Ejemplo n.º 2
0
def manager(request):
  try:
    user = User.objects.get(userID = request.session['userID'])
  except:
    return HttpResponseRedirect("/index/login")
  if request.method == "POST":
    uf = UploadForm(request.POST,request.FILES)
    if uf.is_valid():
      contestID = uf.cleaned_data['contestID']
      xlsAddr = uf.cleaned_data['xlsAddr']
      cx = ContestXls()
      cx.contestID = contestID
      cx.xlsAddr = xlsAddr
      cx.save()
      return HttpResponse('upload ok!')
  else:
    uf = UploadForm()
  if user.userID != "QQ":
    return HttpResponse('you are not permited!')

  return render(request, 'cugbacm/manager.html',{'uf':uf, 'userID':request.session['userID']})
Ejemplo n.º 3
0
def uploadfile(request):
    if request.method == "POST":
        uf = UploadForm(request.POST, request.FILES)
        if uf.is_valid():
            contestID = uf.cleaned_data['contestID']
            xlsAddr = uf.cleaned_data['xlsAddr']
            cx = ContestXls()
            cx.contestID = contestID
            cx.xlsAddr = xlsAddr
            cx.save()
            return HttpResponse('upload ok!')
    else:
        uf = UploadForm()
    return render(request, 'cugbacm/uploadfile.html', {'uf': uf})
Ejemplo n.º 4
0
def manager(request):
    try:
        user = User.objects.get(userID=request.session['userID'])
    except:
        return HttpResponseRedirect("/index/login")
    if request.method == "POST":
        uf = UploadForm(request.POST, request.FILES)
        if uf.is_valid():
            contestID = uf.cleaned_data['contestID']
            xlsAddr = uf.cleaned_data['xlsAddr']
            cx = ContestXls()
            cx.contestID = contestID
            cx.xlsAddr = xlsAddr
            cx.save()
            return HttpResponse('upload ok!')
    else:
        uf = UploadForm()
    if user.userID != "QQ":
        return HttpResponse('you are not permited!')

    return render(request, 'cugbacm/manager.html', {
        'uf': uf,
        'userID': request.session['userID']
    })