X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=quotes%2Fviews.py;h=df4081d5b79b251ff5523b98d283dd470b2367d2;hb=ba8a1a46983d9e26f70a6dab5a2a3aa9ebb5425b;hp=981af054515b7817efb40daae2138b7d34de0b1a;hpb=979f7e231fdda726b78bb00914d4a5e22a1d81b7;p=djsite.git diff --git a/quotes/views.py b/quotes/views.py index 981af05..df4081d 100644 --- a/quotes/views.py +++ b/quotes/views.py @@ -1,10 +1,8 @@ from django.shortcuts import render -from django.http import HttpResponse -from django.template import loader from random import randint -from .models import Author, Quote, Tag +from .models import Author, Work, Quote, Tag # Create your views here. def onequote(request, quote_id): @@ -26,6 +24,11 @@ def author(request, author_id): context = { 'author' : author } return render(request, 'quotes/author.html', context) +def work(request, work_id): + work = Work.objects.get(id=work_id) + context = { 'work': work } + return render(request, 'quotes/work.html', context) + def all(request): quotes = Quote.objects.all() context = { 'quotes' : quotes }