Django 데이터 통계 기능 count()사용
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()내용 은 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 도 많은 응원 부 탁 드 리 겠 습 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Django 라우팅 계층 URLconf 작용 및 원리 해석URL 구성(URLconf)은 Django가 지원하는 웹 사이트의 디렉토리와 같습니다.그것의 본질은 URL과 이 URL을 호출할 보기 함수 사이의 맵표입니다. 위의 예제에서는 URL의 값을 캡처하고 위치 매개 변수로...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.