Added very basic framework for the landing page
This commit is contained in:
parent
a1a8e624d9
commit
a815e29f65
11
LandingPage/templates/landing_page.html
Normal file
11
LandingPage/templates/landing_page.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{% for show in shows %}
|
||||||
|
<div>
|
||||||
|
<h3>{{show.name}} [{{show.abbr}}]</h3>
|
||||||
|
<p>{{show.description}}</p>
|
||||||
|
<ul>
|
||||||
|
{% for ep in show.episodes.all %}
|
||||||
|
<li>Episode {{ep.episode}} — {{ep.airdate}}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
@ -5,5 +5,6 @@ from . import views
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^login/redirect$', views.LoginRedirect.as_view()),
|
url(r'^login/redirect$', views.LoginRedirect.as_view()),
|
||||||
url(r'^login$', views.Login.as_view()),
|
url(r'^login$', views.Login.as_view()),
|
||||||
|
url(r'^$', views.LandingPage.as_view()),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
from django.views.generic.base import TemplateView
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.db.models import Max
|
||||||
import requests
|
import requests
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
from .models import User
|
from .models import User
|
||||||
|
from .models import Show
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
# Redirect url should point to this view
|
# 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(request.session.session_key, 'utf-8'))
|
||||||
m.update(bytearray(settings.SECRET_KEY, 'utf-8'))
|
m.update(bytearray(settings.SECRET_KEY, 'utf-8'))
|
||||||
return m.hexdigest()
|
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
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user