dynamic number

This commit is contained in:
j 2021-10-27 12:37:40 +01:00
parent 7e02c13372
commit 3f642bb591
2 changed files with 9 additions and 5 deletions

View file

@ -15,12 +15,12 @@
<div class="font-size-sm"> <div class="font-size-sm">
<div class="h3"><a href="{% url 'films'%}" class="font-bold">Films 影片</a></div> <div class="h3"><a href="{% url 'films'%}" class="font-bold">Films 影片</a></div>
<p class="margin-reset">16 films on Asian futures, past and present</p> <p class="margin-reset">{{ films }} films on Asian futures, past and present</p>
<p>16 部關於亞洲未來、過去與現在的影片<p> <p>{{ films }}部關於亞洲未來、過去與現在的影片<p>
<div class="h3"><a href="{% url 'texts' %}" class="font-bold">Assemblies 選集</a></div> <div class="h3"><a href="{% url 'texts' %}" class="font-bold">Assemblies 選集</a></div>
<p class="margin-reset">32 video essays within or across films</p> <p class="margin-reset">{{ texts }} video essays within or across films</p>
<p>32篇影像隨筆與解析<p> <p>{{ texts}}篇影像隨筆與解析<p>
<div class="h3"><a href="{% url 'about' %}" class="font-bold">About 關於</a></div> <div class="h3"><a href="{% url 'about' %}" class="font-bold">About 關於</a></div>
</div> </div>

View file

@ -7,7 +7,11 @@ def fallback(request):
return render(request, 'fallback.html', context) return render(request, 'fallback.html', context)
def index(request): def index(request):
from ..video.models import Film
from ..text.models import Text
context = {} context = {}
context['films'] = Film.objects.filter(public=True).count()
context['texts'] = Text.objects.filter(public=True).count()
return render(request, 'index.html', context) return render(request, 'index.html', context)
#def index_alt(request): #def index_alt(request):