68 lines
2.1 KiB
Python
68 lines
2.1 KiB
Python
from django.shortcuts import render
|
|
from django.views.generic import TemplateView
|
|
from .models import TournamentPage
|
|
|
|
# Create your views here.
|
|
|
|
|
|
class HomeView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(id=id, published=True)
|
|
return {'t': t, 'content': t.homepage, 'homepage': True}
|
|
|
|
|
|
class ScheduleAndResultsView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(
|
|
id=id, published=True, schedule_and_results_enabled=True)
|
|
return {'t': t, 'content': t.schedule_and_results, 'schedule_and_results': True}
|
|
|
|
|
|
class RegistrationView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(
|
|
id=id, published=True, registration_enabled=True)
|
|
return {'t': t, 'content': t.registration, 'registration': True}
|
|
|
|
|
|
class RulesView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(
|
|
id=id, published=True, rules_enabled=True)
|
|
return {'t': t, 'content': t.rules, 'rules': True}
|
|
|
|
|
|
class FeeAndPrizesView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(
|
|
id=id, published=True, fee_and_prizes_enabled=True)
|
|
return {'t': t, 'content': t.fee_and_prizes, 'fee_and_prizes': True}
|
|
|
|
|
|
class AccomodationView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(
|
|
id=id, published=True, accomodation_enabled=True)
|
|
return {'t': t, 'content': t.accomodation, 'accomodation': True}
|
|
|
|
|
|
class ContactView(TemplateView):
|
|
template_name = "tournament.html"
|
|
|
|
def get_context_data(self, id, **kwargs):
|
|
t = TournamentPage.objects.get(
|
|
id=id, published=True, contact_enabled=True)
|
|
return {'t': t, 'content': t.contact, 'contact': True}
|