22 lines
598 B
Python
22 lines
598 B
Python
|
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):
|
||
|
context = {}
|
||
|
context['essay'] = get_object_or_404(models.Essay, slug=slug)
|
||
|
return render(request, 'essay.html', context)
|