From 680d7786cf51a3743b6c74061ac58e0a3c62e1f7 Mon Sep 17 00:00:00 2001
From: Rushil Umaretiya <2023rumareti@tjhsst.edu>
Date: Wed, 21 Oct 2020 22:41:48 -0400
Subject: [PATCH] fixed indexing

---
 pages/templates/pages/index.html |  6 +++---
 pages/views.py                   | 14 +++++---------
 2 files changed, 8 insertions(+), 12 deletions(-)

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 @@
     <p class="lead">We are the class to beat!</p>
   </div>
 </div>
-<div class="container news mb-5">
+<div class="container news mb-2">
     <h1 class="text-center font-weight-bold">2023 News</h1>
     <br><br>
     <div class="row">
@@ -27,7 +27,7 @@
     </div>
 </div>
 
-{% if bar %}
+{% for bar in bars %}
   <div class="container news">
       <h1 class="text-center font-weight-bold">{{ bar.name }}!</h1>
       <br><br>
@@ -55,5 +55,5 @@
       });
       </script>
   </div>
-{% 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):