unlisted public items
This commit is contained in:
parent
1d315da072
commit
2d59fc468e
3 changed files with 21 additions and 2 deletions
18
app/text/migrations/0009_text_listed.py
Normal file
18
app/text/migrations/0009_text_listed.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -43,6 +43,7 @@ class Text(models.Model):
|
||||||
language = models.CharField(choices=LANGUAGE_CHOICES, max_length=8, default='en')
|
language = models.CharField(choices=LANGUAGE_CHOICES, max_length=8, default='en')
|
||||||
slug = models.SlugField()
|
slug = models.SlugField()
|
||||||
public = models.BooleanField(default=False)
|
public = models.BooleanField(default=False)
|
||||||
|
listed = models.BooleanField("List this item on overview page", default=True)
|
||||||
position = models.IntegerField(default=0)
|
position = models.IntegerField(default=0)
|
||||||
|
|
||||||
title = models.TextField()
|
title = models.TextField()
|
||||||
|
|
|
@ -17,7 +17,7 @@ def index(request):
|
||||||
from ..text.models import Text
|
from ..text.models import Text
|
||||||
context = {}
|
context = {}
|
||||||
context['films'] = Film.objects.filter(public=True).count()
|
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)
|
context['stream_prefix'] = get_stream_prefix(request)
|
||||||
featured = Film.objects.filter(featured=True)
|
featured = Film.objects.filter(featured=True)
|
||||||
featured_count = featured.count()
|
featured_count = featured.count()
|
||||||
|
@ -49,7 +49,7 @@ def about(request):
|
||||||
|
|
||||||
def texts(request):
|
def texts(request):
|
||||||
context = {}
|
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()
|
context['texts'] = all_texts.filter()
|
||||||
return render(request, 'texts.html', context)
|
return render(request, 'texts.html', context)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue