证书只显示月份

This commit is contained in:
caoqianming 2022-03-27 16:51:29 +08:00
parent 4677027bc6
commit 15f024bf1a
2 changed files with 9 additions and 7 deletions

View File

@ -140,7 +140,7 @@
class="inner-cell" data-tag="idtype">身份证</span><span contenteditable="false" class="inner-cell" data-tag="idtype">身份证</span><span contenteditable="false"
class="inner-cell" data-tag="idno">{{candidate.ID_number}}</span>,于 class="inner-cell" data-tag="idno">{{candidate.ID_number}}</span>,于
<!-- <span contenteditable="false" class="inner-cell" data-tag="examyear">2021</span>年 --> <!-- <span contenteditable="false" class="inner-cell" data-tag="examyear">2021</span>年 -->
<span contenteditable="false" class="inner-cell" data-tag="exammonth">{{candidate.examtest_date|date}}</span>参加&nbsp; <span contenteditable="false" class="inner-cell" data-tag="exammonth">{{candidate.exam_year}}年{{candidate.exam_month}}月</span>参加&nbsp;
<span contenteditable="false" <span contenteditable="false"
class="inner-cell" data-tag="pworktype">{{candidate.workscope_name}}</span>&nbsp;辐射安全与防护考核,成绩合格。</div> class="inner-cell" data-tag="pworktype">{{candidate.workscope_name}}</span>&nbsp;辐射安全与防护考核,成绩合格。</div>
</div> </div>

View File

@ -682,12 +682,14 @@ from django.shortcuts import render
from django.http import Http404 from django.http import Http404
def candidate(request): def candidate(request):
if request.GET.get('id', None): if request.GET.get('id', None):
try: # try:
candidate = Candidate.objects.get(id=request.GET.get('id'), number__isnull=False) candidate = Candidate.objects.get(id=request.GET.get('id'), number__isnull=False)
candidate.msg = get_msg_from_id(candidate.ID_number) candidate.msg = get_msg_from_id(candidate.ID_number)
return render(request, 'index.html', {"candidate":candidate}) candidate.exam_year = candidate.examtest_date.year
except: candidate.exam_month = candidate.examtest_date.month
raise Http404 return render(request, 'index.html', {"candidate":candidate})
# except:
# raise Http404
raise Http404 raise Http404
def get_msg_from_id(id_number): def get_msg_from_id(id_number):