unlisted public items

This commit is contained in:
j 2022-09-25 19:09:52 +01:00
parent 1d315da072
commit 2d59fc468e
3 changed files with 21 additions and 2 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 3.2.15 on 2022-09-25 18:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('text', '0008_auto_20211028_1007'),
]
operations = [
migrations.AddField(
model_name='text',
name='listed',
field=models.BooleanField(default=True, verbose_name='Include in list if public'),
),
]

View file

@ -43,6 +43,7 @@ class Text(models.Model):
language = models.CharField(choices=LANGUAGE_CHOICES, max_length=8, default='en')
slug = models.SlugField()
public = models.BooleanField(default=False)
listed = models.BooleanField("List this item on overview page", default=True)
position = models.IntegerField(default=0)
title = models.TextField()

View file

@ -17,7 +17,7 @@ def index(request):
from ..text.models import Text
context = {}
context['films'] = Film.objects.filter(public=True).count()
context['texts'] = Text.objects.filter(public=True).count()
context['texts'] = Text.objects.filter(public=True, listed=True).count()
context['stream_prefix'] = get_stream_prefix(request)
featured = Film.objects.filter(featured=True)
featured_count = featured.count()
@ -49,7 +49,7 @@ def about(request):
def texts(request):
context = {}
all_texts = models.Text.objects.filter(public=True).order_by('position', 'created')
all_texts = models.Text.objects.filter(public=True, listed=True).order_by('position', 'created')
context['texts'] = all_texts.filter()
return render(request, 'texts.html', context)