]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/views.py
Add a 'work' concept
[djsite.git] / quotes / views.py
index 981af054515b7817efb40daae2138b7d34de0b1a..bd7f6f605bb142cd44ad196368fa252162dd421c 100644 (file)
@@ -4,7 +4,7 @@ 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 +26,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 }