diff --git a/aleksis/apps/chronos/frontend/index.js b/aleksis/apps/chronos/frontend/index.js index 0414c125ea5c304433084070a4eb627bf9bad62e..4749ac593afcd244d9d4f06b992ef6dea99c0225 100644 --- a/aleksis/apps/chronos/frontend/index.js +++ b/aleksis/apps/chronos/frontend/index.js @@ -32,5 +32,21 @@ export default { fullWidth: true, }, }, + { + path: "substitutions/print/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "chronos.substitutions", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + { + path: "substitutions/print/:date/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "chronos.substitutionsByDate", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, ], }; diff --git a/aleksis/apps/chronos/urls.py b/aleksis/apps/chronos/urls.py index 7d55323042b9a23438975c589bd23967c3cbb396..0e3a3e7f10bf87613a2614fbd299ced106be0d96 100644 --- a/aleksis/apps/chronos/urls.py +++ b/aleksis/apps/chronos/urls.py @@ -8,4 +8,9 @@ urlpatterns = [ views.substitutions_print, name="substitutions_print", ), + path( + "substitutions/print/<str:day>/", + views.substitutions_print, + name="substitutions_print", + ), ] diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py index a45997ca580db9f8fa442be52d88054055e2661d..84d093728e50825f90358084909d828f48cc7d71 100644 --- a/aleksis/apps/chronos/views.py +++ b/aleksis/apps/chronos/views.py @@ -1,10 +1,10 @@ +from datetime import date, datetime from typing import Optional from django.http import HttpRequest, HttpResponse from rules.contrib.views import permission_required -from aleksis.core.decorators import pwa_cache from aleksis.core.util.pdf import render_pdf from .util.chronos_helpers import ( @@ -12,14 +12,12 @@ from .util.chronos_helpers import ( ) -@pwa_cache @permission_required("chronos.view_substitutions_rule") def substitutions_print( request: HttpRequest, - year: Optional[int] = None, - month: Optional[int] = None, - day: Optional[int] = None, + day: Optional[str] = None, ) -> HttpResponse: """View all substitutions on a specified day.""" - context = get_substitutions_context_data(request, year, month, day, is_print=True) + day = datetime.strptime(day, "%Y-%m-%d").date() if day else date.today() + context = get_substitutions_context_data(day) return render_pdf(request, "chronos/substitutions_print.html", context)