1#!/usr/bin/env python3
 2
 3"""Event classes web page.
 4"""
 5
 6from django.shortcuts import render
 7from django.views.decorators.cache import cache_page
 8
 9from chart.events.eventclass import EventClass
10
11
12@cache_page(86400)
13def index(request):
14    """Return a page listing all available event classes."""
15
16    return render(request,
17                  'events/all_eventclasses.html',
18                  {'eventclasses': EventClass.all()})
19
20
21@cache_page(86400)
22def single_eventclass(request, eventclass):
23    """Return a page giving details of a single event class."""
24
25    return render(request,
26                  'events/single_eventclass.html',
27                  {'eventclass': EventClass(eventclass)})