From 427693fb9f744b39b82f3665aa66d7661dbe49e2 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Fri, 9 Oct 2026 12:39:08 -0500 Subject: [PATCH] Show a message when the calendar has no events. Closes #34. Upcoming and Past tabs explain an empty list instead of leaving the content area blank. --- schasite/templates/schasite/calendar2.html | 14 ++++++++++++-- schasite/tests.py | 9 +++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/schasite/templates/schasite/calendar2.html b/schasite/templates/schasite/calendar2.html index be73f45..6aa709b 100644 --- a/schasite/templates/schasite/calendar2.html +++ b/schasite/templates/schasite/calendar2.html @@ -136,6 +136,12 @@ + {% empty %} +
+
+ There are no upcoming events to display. +
+
{% endfor %} @@ -179,9 +185,13 @@ + {% empty %} +
+
+ There are no past events to display. +
+
{% endfor %} - - diff --git a/schasite/tests.py b/schasite/tests.py index afdc331..6c48d67 100644 --- a/schasite/tests.py +++ b/schasite/tests.py @@ -66,6 +66,13 @@ class PublicPageTests(TestCase): response = self.client.get(reverse("calendar2")) self.assertEqual(response.status_code, 200) + def test_calendar_shows_empty_state_when_no_events(self): + response = self.client.get(reverse("calendar2")) + + self.assertEqual(response.status_code, 200) + self.assertContains(response, "There are no upcoming events to display.") + self.assertContains(response, "There are no past events to display.") + def test_newsletters_renders(self): response = self.client.get(reverse("newsletters2")) self.assertEqual(response.status_code, 200) @@ -414,6 +421,8 @@ class CalendarEventTests(TestCase): self.assertNotIn("Ongoing Event", past_html) self.assertIn("Archived Picnic", past_html) self.assertNotIn("Archived Picnic", upcoming_html) + self.assertNotIn("There are no upcoming events to display.", upcoming_html) + self.assertNotIn("There are no past events to display.", past_html) @override_settings(