njpma/app/text/views.py

26 lines
684 B
Python
Raw Normal View History

2021-09-28 13:10:22 +00:00
from django.shortcuts import render, redirect, get_object_or_404
from . import models
2021-10-10 15:06:43 +00:00
def fallback(request):
context = {}
return render(request, 'fallback.html', context)
2021-09-28 13:10:22 +00:00
def index(request):
context = {}
return render(request, 'index.html', context)
def about(request):
context = {}
return render(request, 'about.html', context)
2021-10-10 15:06:43 +00:00
def texts(request):
2021-09-28 13:10:22 +00:00
context = {}
2021-10-10 15:06:43 +00:00
context['texts'] = models.Text.objects.filter(public=True).order_by('created')
return render(request, 'texts.html', context)
2021-09-28 13:10:22 +00:00
2021-10-10 15:06:43 +00:00
def text(request, slug):
2021-09-28 13:10:22 +00:00
context = {}
2021-10-10 15:06:43 +00:00
context['text'] = get_object_or_404(models.Text, slug=slug)
return render(request, 'text.html', context)