✍ 출석부 조회할 show.html 생성
<div class="regibox" align="center">
<form method="POST" action="show1">
{% csrf_token %}
<input type="date" id="date" name="date" value="2021-02-20" min="2021-02-20" max="2022-01-01">
<br><br>
<button type="submit" value="submit">출석부 조회</button>
</form>
</div>
✍ 출석부 조회할 show.html 띄울 함수 생성
def show(request):
return render(request,'show.html')
✍ 출석부 조회할 show1.html 생성
<div class="table">
<h3>{{date}} 출석부</h3>
<table>
<thead>
<th>이름</th>
<th>출결</th>
</thead>
<tbody>
{% for info in info %}
<tr>
<td>{{info.name}}</td>
<td bgcolor="#FFEFD5">{{info.attendance}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
✍ 출석부 조회할 함수 생성
def show1(request):
date=request.POST['date']
info = Attendance.objects.filter(date__contains='{}'.format(date))
return render(request,'show1.html',{'info':info, 'date':date})