X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=quotes%2Fviews.py;h=4e66378bc6ea8cc8ad5acf7937afae14c5002350;hb=c0ce9798b8cb154c7fd1d4a1a9c6ab52c197be5c;hp=bd7f6f605bb142cd44ad196368fa252162dd421c;hpb=13c2e4fc8a5506cfa074c06335a73d28a173aba9;p=djsite.git diff --git a/quotes/views.py b/quotes/views.py index bd7f6f6..4e66378 100644 --- a/quotes/views.py +++ b/quotes/views.py @@ -1,14 +1,13 @@ from django.shortcuts import render -from django.http import HttpResponse -from django.template import loader from random import randint -from .models import Author, Work, Quote, Tag +from .models import Author, Work, Quote, QuoteTag # Create your views here. def onequote(request, quote_id): q = Quote.objects.get(id=quote_id) + q.incr_display() context = { 'quote' : q } return render(request, 'quotes/onequote.html', context) @@ -17,17 +16,19 @@ def random(request): return onequote(request, randint(1, count)) def tags(request, tag_id): - tag = Tag.objects.get(id=tag_id) + tag = QuoteTag.objects.get(id=tag_id) context = { 'tag' : tag } return render(request, 'quotes/tag.html', context) def author(request, author_id): author = Author.objects.get(id=author_id) + author.incr_display() context = { 'author' : author } return render(request, 'quotes/author.html', context) def work(request, work_id): work = Work.objects.get(id=work_id) + work.incr_display() context = { 'work': work } return render(request, 'quotes/work.html', context)