diff --git a/LandingPage/templates/landing_page.html b/LandingPage/templates/landing_page.html
new file mode 100644
index 0000000..3501747
--- /dev/null
+++ b/LandingPage/templates/landing_page.html
@@ -0,0 +1,11 @@
+{% for show in shows %}
+
+
{{show.name}} [{{show.abbr}}]
+
{{show.description}}
+
+ {% for ep in show.episodes.all %}
+ - Episode {{ep.episode}} — {{ep.airdate}}
+ {% endfor %}
+
+
+{% endfor %}
diff --git a/LandingPage/urls.py b/LandingPage/urls.py
index ae09a29..8c4c86d 100644
--- a/LandingPage/urls.py
+++ b/LandingPage/urls.py
@@ -5,5 +5,6 @@ from . import views
urlpatterns = [
url(r'^login/redirect$', views.LoginRedirect.as_view()),
url(r'^login$', views.Login.as_view()),
+ url(r'^$', views.LandingPage.as_view()),
]
diff --git a/LandingPage/views.py b/LandingPage/views.py
index dd4be9f..8fcd39a 100644
--- a/LandingPage/views.py
+++ b/LandingPage/views.py
@@ -1,12 +1,15 @@
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 django.db.models import Max
import requests
import hashlib
import json
from .models import User
+from .models import Show
# Create your views here.
# Redirect url should point to this view
@@ -77,3 +80,14 @@ def generateState(request):
m.update(bytearray(request.session.session_key, 'utf-8'))
m.update(bytearray(settings.SECRET_KEY, 'utf-8'))
return m.hexdigest()
+
+class LandingPage(TemplateView):
+
+ template_name = "landing_page.html"
+
+ def get_context_data(self, **kwargs):
+ ctx = super().get_context_data()
+ ctx['shows'] = Show.objects.annotate(recency=Max('episodes__airdate')).order_by('-recency')[:8]
+ return ctx
+
+