24 lines
788 B
Python
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
|