# Create your views here. from django.template import Context, Template from biblequotes.models import Quote from random import randint from django.http import HttpResponse def randomQuote(request): count = Quote.objects.count() qid = randint(1, count) quote = Quote.objects.get(id=qid) t = Template("{{quote.book}}, {{quote.chapter}}:{{quote.verse}}
{{quote.text}}") html = t.render(Context({'quote':quote})) return HttpResponse(html)