Django 데이터 통계 기능 count()사용

1049 단어 Djangocount()
1.view 실현 계수
apiviews.py 에 다음 내용 을 추가 합 니 다.

from ApiTest.models import ApiTest
from django.shortcuts import render

def api_test_manage(request):
	apitest_count = ApiTest.objects.all().count()
	return render(request, "apitest_manage.html", {'user': username, 'apitests': apitest_list, 'apitests_count': apitest_count})
2.Html 데이터 렌 더 링 전시
apitest 에서manage.html 에 추가:

<!--            >
<span style="position:absolute; right:100px; bottom: 30px;">

<div style="position:absolute; right:100px; bottom: 15px;">
  <tr><th>  : </th><td>{{ apitests_count }}</td></tr>
</div>
3.효과 전시
在这里插入图片描述
Django 데이터 통계 기능 count()의 사용 에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 Django count()내용 은 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 도 많은 응원 부 탁 드 리 겠 습 니 다!

좋은 웹페이지 즐겨찾기