]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/views.py
Add a simple display counter
[djsite.git] / quotes / views.py
index 9bed533b045f73e0385f32c934e5c780d3cc2b70..4e66378bc6ea8cc8ad5acf7937afae14c5002350 100644 (file)
@@ -7,6 +7,7 @@ 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)
 
@@ -21,11 +22,13 @@ def tags(request, tag_id):
 
 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)