dr.botzo/races/views.py

27 lines
547 B
Python
Raw Normal View History

2015-05-21 21:57:54 -05:00
"""Display race statuses and whatnot."""
import logging
from django.shortcuts import get_object_or_404, render
from races.models import Race, Racer, RaceUpdate
2015-05-21 22:05:10 -05:00
log = logging.getLogger('races.views')
def index(request):
"""Display a list of races."""
races = Race.objects.all()
return render(request, 'races/index.html', {'races': races})
def race_detail(request, race_id):
"""Display a race detail."""
race = get_object_or_404(Race, pk=race_id)
return render(request, 'races/race_detail.html', {'race': race})