Titivillus/quest/views.py

26 lines
645 B
Python
Raw Normal View History

2018-08-10 08:39:51 -04:00
#!/usr/bin/env python3
"""
Quest and quest accessory views.
"""
from django.shortcuts import render
from django.http import HttpResponse
2018-08-13 13:17:51 -04:00
from .models import Quest
2018-08-10 08:39:51 -04:00
def index(request):
"""
/quest page index. Possibly not needed.
"""
#return render(request, "Hello, world. You're at the quest index.", {})
return HttpResponse("Hello, world. You're at the quest index.")
def quest(request, quest_id, page_num=1):
"""
Arbituary quest page view.
"""
2018-08-13 13:17:51 -04:00
quest = Quest.objects.get(id=quest_id)
posts = quest.post_set.all()
context = {'quest': quest, 'posts': posts, 'page_num': page_num}
return render(request, 'quest/quest.html', context)