26 lines
623 B
Python
26 lines
623 B
Python
"""Display choice sets."""
|
|
|
|
import logging
|
|
|
|
from django.shortcuts import get_object_or_404, render
|
|
|
|
from choices.models import ChoiceSet
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
def index(request):
|
|
"""Display nothing, for the moment."""
|
|
|
|
choicesets = ChoiceSet.objects.all()
|
|
|
|
return render(request, 'choices/index.html', {'choicesets': choicesets})
|
|
|
|
|
|
def choiceset_detail(request, set_name):
|
|
"""Display info, and a random choice, for the requested choice set."""
|
|
|
|
choiceset = get_object_or_404(ChoiceSet, name=set_name)
|
|
|
|
return render(request, 'choices/choiceset_detail.html', {'choiceset': choiceset})
|