This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
Episodes.Community/Show/views.py
2017-11-10 15:55:39 +02:00

24 lines
788 B
Python

from django.shortcuts import render
from django.shortcuts import render
from django.views import View
from django.views.generic.base import TemplateView
from django.conf import settings
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from LandingPage.models import Show
from LandingPage.models import Season
from LandingPage.models import Episode
# Create your views here.
class Index (TemplateView):
template_name = "show.html"
def get_context_data(self, abbreviation, **kwargs):
ctx = super().get_context_data()
ctx['show'] = Show.objects.filter(abbr=abbreviation).first()
ctx['seasons'] = Season.objects.filter(show=ctx['show'])
ctx['episodes'] = Episode.objects.filter(show=ctx['show'])
return ctx