njpma/app/text/views.py

22 lines
604 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
def index(request):
context = {}
return render(request, 'index.html', context)
def about(request):
context = {}
return render(request, 'about.html', context)
def essays(request):
context = {}
context['essays'] = models.Essay.objects.filter(public=True).order_by('created')
return render(request, 'essays.html', context)
def essay(request, slug, lang):
2021-09-28 13:10:22 +00:00
context = {}
context['essay'] = get_object_or_404(models.Essay, slug=slug)
return render(request, 'essay.html', context)