add the ability to disable the web display of some apps
This commit is contained in:
@@ -1,26 +1,28 @@
|
||||
"""Display race statuses and whatnot."""
|
||||
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
||||
from races.models import Race, Racer, RaceUpdate
|
||||
|
||||
|
||||
log = logging.getLogger('races.views')
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def index(request):
|
||||
"""Display a list of races."""
|
||||
if 'races' not in settings.WEB_ENABLED_APPS:
|
||||
raise PermissionDenied()
|
||||
|
||||
races = Race.objects.all()
|
||||
|
||||
return render(request, 'races/index.html', {'races': races})
|
||||
|
||||
|
||||
def race_detail(request, race_id):
|
||||
"""Display a race detail."""
|
||||
if 'races' not in settings.WEB_ENABLED_APPS:
|
||||
raise PermissionDenied()
|
||||
|
||||
race = get_object_or_404(Race, pk=race_id)
|
||||
|
||||
return render(request, 'races/race_detail.html', {'race': race})
|
||||
|
||||
Reference in New Issue
Block a user