diff --git a/pages/templates/pages/index.html b/pages/templates/pages/index.html index 915c3fc..1fe8c34 100644 --- a/pages/templates/pages/index.html +++ b/pages/templates/pages/index.html @@ -11,7 +11,7 @@

We are the class to beat!

-
+

2023 News



@@ -27,7 +27,7 @@
-{% if bar %} +{% for bar in bars %}

{{ bar.name }}!



@@ -55,5 +55,5 @@ });
-{% endif %} +{% endfor %} {% endblock content %} \ No newline at end of file diff --git a/pages/views.py b/pages/views.py index 14abd61..2cb90e3 100644 --- a/pages/views.py +++ b/pages/views.py @@ -4,21 +4,17 @@ from .models import Story, Bar # Create your views here. def index(request): - try: - stories = Story.objects.all().order_by('-created') - bar = Bar.objects.all()[0] - stories = stories[:3] - except Exception: - stories = [] - bar = None + stories = Story.objects.all().order_by('-created')[:3] + bar = Bar.objects.all()[:1] context = { 'stories': stories, 'animate': True, - 'bar': bar + 'bars': bar } + print(stories) - return render(request, 'pages/index.html', context) + return render(request, 'pages/index.html', context=context) def council(request):