add language field to text model, output en and zh texts separately, refs #30

This commit is contained in:
Sanjay B 2021-10-28 15:42:34 +05:30
commit 21dab42524
5 changed files with 44 additions and 6 deletions

View file

@ -36,7 +36,9 @@ def about(request):
def texts(request):
context = {}
context['texts'] = models.Text.objects.filter(public=True).order_by('position', 'created')
all_texts = models.Text.objects.filter(public=True).order_by('position', 'created')
context['en_texts'] = all_texts.filter(language='en')
context['zh_texts'] = all_texts.filter(language='zh')
return render(request, 'texts.html', context)
def text(request, slug):