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-29 14:01:31 -04:00
|
|
|
from .models import Quest, DiceRoll, PollOption, PollVote
|
2018-08-13 13:17:51 -04:00
|
|
|
|
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)
|
2018-08-20 06:57:36 -04:00
|
|
|
messages = quest.message_set.all()
|
2018-08-13 13:17:51 -04:00
|
|
|
posts = quest.post_set.all()
|
2018-08-24 21:51:03 -04:00
|
|
|
dice_rolls = DiceRoll.objects.filter(dicecall__post__quest__id=quest_id)
|
2018-08-29 14:01:31 -04:00
|
|
|
poll_options = PollOption.objects.filter(poll__post__quest__id=quest_id)
|
|
|
|
poll_votes = PollVote.objects.filter(option__poll__post__quest__id=quest_id)
|
2018-09-03 17:59:41 -04:00
|
|
|
ip_address = request.META['REMOTE_ADDR']
|
2018-08-24 21:51:03 -04:00
|
|
|
context = locals()
|
2018-08-13 13:17:51 -04:00
|
|
|
return render(request, 'quest/quest.html', context)
|