From 15f024bf1a5a3ff83724031cbb0029ef2f7d595c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 27 Mar 2022 16:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=81=E4=B9=A6=E5=8F=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=9C=88=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_server/crm/templates/index.html | 2 +- test_server/crm/views.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test_server/crm/templates/index.html b/test_server/crm/templates/index.html index 6a1b758..0eaecaf 100644 --- a/test_server/crm/templates/index.html +++ b/test_server/crm/templates/index.html @@ -140,7 +140,7 @@ class="inner-cell" data-tag="idtype">身份证:{{candidate.ID_number}},于 - {{candidate.examtest_date|date}}参加  + {{candidate.exam_year}}年{{candidate.exam_month}}月参加  {{candidate.workscope_name}} 辐射安全与防护考核,成绩合格。 diff --git a/test_server/crm/views.py b/test_server/crm/views.py index da3da27..cdfa056 100644 --- a/test_server/crm/views.py +++ b/test_server/crm/views.py @@ -682,12 +682,14 @@ from django.shortcuts import render from django.http import Http404 def candidate(request): if request.GET.get('id', None): - try: - candidate = Candidate.objects.get(id=request.GET.get('id'), number__isnull=False) - candidate.msg = get_msg_from_id(candidate.ID_number) - return render(request, 'index.html', {"candidate":candidate}) - except: - raise Http404 + # try: + candidate = Candidate.objects.get(id=request.GET.get('id'), number__isnull=False) + candidate.msg = get_msg_from_id(candidate.ID_number) + candidate.exam_year = candidate.examtest_date.year + candidate.exam_month = candidate.examtest_date.month + return render(request, 'index.html', {"candidate":candidate}) + # except: + # raise Http404 raise Http404 def get_msg_from_id(id_number):