36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from django.shortcuts import render
|
|
from django.views.generic import TemplateView
|
|
# Create your views here.
|
|
|
|
from game.models import Level
|
|
|
|
|
|
class IndexView(TemplateView):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
return render(request, "game/index.html", context={})
|
|
|
|
class TermsView(TemplateView):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
return render(request, "game/terms.html", context={})
|
|
|
|
class GameView(TemplateView):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
if type(kwargs.get("pk")) is int:
|
|
level = Level.objects.get(id=kwargs["pk"])
|
|
if level:
|
|
return render(request, "game/level.html", context={
|
|
"flashVars": level.getFlashVars(seperator="&")
|
|
})
|
|
|
|
return render(request, "game/game.html", context={})
|
|
|
|
class WIPView(TemplateView):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
return render(request, "game/error.html", context={})
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
return render(request, "game/error.html", context={}) |