山东大学-VirtualJudge-总结9

实现了在contest中的clarification功能以及对于已经存在的问题进行了修改:
【山东大学-VirtualJudge-总结9】部分核心代码:


def contest_clarification(req,cid): #pid=req.GET.get("proid") #pro = Problem.objects.get(proid=proid) contest = Contest.objects.get(id = cid) isAuthor = req.user == contest.uid print('OUT POST clar', req.POST.get('clar')) print('OUT GET clar', req.GET.get('clar')) if not req.POST.get('clar') : #print('GET count', Contest_clarification.objects.filter(contest=contest).count()) return render(req,'contest/contest_clar.html',{'contest':contest,'list': Contest_clarification.objects.filter(contest=contest).order_by('-time'), 'isAuthor':isAuthor}) else : #print('POST count', Contest_clarification.objects.filter(contest=contest).count()) #print('POST clar', req.POST.get('clar')) if isAuthor: contest_clarification = Contest_clarification(contest = contest, clarification = req.POST.get('clar'), time = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))) contest_clarification.save() return render(req,'contest/contest_clar.html',{'contest':contest, 'list': Contest_clarification.objects.filter(contest=contest).order_by('-time'), 'isAuthor':isAuthor })def dateToInt(date, field): if field == 0: return date.days * 24 * 60 + date.seconds // 60 else: return date.days * 24 * 60 *60+ date.seconds

    推荐阅读