Skip to content

Commit

Permalink
Merge pull request #172 from springload/feature/add-past-exec-committ…
Browse files Browse the repository at this point in the history
…ee-category

fix by semester path
  • Loading branch information
sarahframe authored Aug 20, 2024
2 parents 8b7a7a9 + 930f11e commit 70b098e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cdhweb/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from taggit.managers import TaggableManager
from taggit.models import TaggedItemBase
from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel
from wagtail.contrib.routable_page.models import RoutablePageMixin, path
from wagtail.contrib.routable_page.models import RoutablePageMixin, path, re_path
from wagtail.fields import RichTextField
from wagtail.models import Page, PageManager, PageQuerySet
from wagtail.search import index
Expand Down Expand Up @@ -433,9 +433,9 @@ def get_context(self, request, semester=None, year=None):
context["date_list"] = self.get_semester_date_list()
return context

@path("<semester>-<int:year>/", name="by-semester")
@re_path(r"^(?P<semester>spring|summer|fall)-(?P<year>\d{4})", name="by-semester")
def by_semester(self, request, semester=None, year=None):
context = self.get_context(request, semester=semester, year=year)
context = self.get_context(request, semester=semester, year=int(year))
return self.render(request, context_overrides=context)

@path("<int:year>/<int:month>/<slug:slug>/", name="dated_child")
Expand Down Expand Up @@ -464,7 +464,7 @@ def get_upcoming_events_for_semester(self, semester, year):
start_date = datetime.date(year, 9, 1)
end_date = datetime.date(year, 12, 31)
else:
raise ValueError("Invalid semester")
raise ValueError(f"Invalid semester: {semester}")

child_pages = self.get_children().live().type(Event)
# Filter events based on start_time within the semester range
Expand Down

0 comments on commit 70b098e

Please sign in to comment.