From 5c6a2f61051feeb1c0f0ba78f5aa9c6f8d20e9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Mogu=C3=A9rou?= Date: Sat, 18 May 2024 10:32:16 +0200 Subject: [PATCH] temp public listing for sharing --- colloscope/urls.py | 18 +++++++++--------- colloscope/views.py | 6 ++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/colloscope/urls.py b/colloscope/urls.py index 3063c93..9626f25 100644 --- a/colloscope/urls.py +++ b/colloscope/urls.py @@ -4,17 +4,17 @@ from . import views from .views import ColleListView urlpatterns = [ - path("", lambda req: redirect("colloscope:dashboard"), name="home"), - path("table", views.colloscope, name="table"), - path("dashboard", views.dashboard, name="dashboard"), + path("/", lambda req: redirect("colloscope:dashboard"), name="home"), + path("table/", views.colloscope, name="table"), + path("dashboard/", views.dashboard, name="dashboard"), path("export.pdf", views.export, name="export"), path("export/calendar//calendar.ics", views.icalendar, name="export-ics"), path("calendrier.ics", lambda req: redirect("colloscope:export-ics", key=req.GET.get("key")), name="export-ics-old"), - path("marketplace", views.marketplace, name="marketplace"), - path("action/enroll", views.enroll, name="enroll"), - path("action/withdraw", views.withdraw, name="withdraw"), - path("listing/", ColleListView.as_view(), name="colles"), - path("listing/by_subject//", ColleListView.as_view(), name="colles_by_subject"), - path("listing/by_colleur//", ColleListView.as_view(), name="colles_by_colleur"), + path("marketplace/", views.marketplace, name="marketplace"), + path("action/enroll/", views.enroll, name="enroll"), + path("action/withdraw/", views.withdraw, name="withdraw"), + path("listing//", ColleListView.as_view(), name="colles"), + path("listing//by_subject//", ColleListView.as_view(), name="colles_by_subject"), + path("listing//by_colleur//", ColleListView.as_view(), name="colles_by_colleur"), ] diff --git a/colloscope/views.py b/colloscope/views.py index d4ef940..4b0d8e5 100644 --- a/colloscope/views.py +++ b/colloscope/views.py @@ -25,13 +25,15 @@ class ColleListView(LoginRequiredMixin, ListView): context_object_name = "colles" def get_queryset(self): - student = self.request.user.profile.student - base_query = (student.cls + term = Term.objects.get(pk=self.kwargs.get("term")) + base_query = (term.cls .current_term() .query_colles() .filter(datetime__gte=date.today())) if self.kwargs.get("subject") is not None: + print(base_query) + print(self.kwargs.get("subject")) base_query = base_query.filter(slot__subject__id=self.kwargs.get("subject")) if self.kwargs.get("colleur") is not None: base_query = base_query.filter(slot__colleur__id=self.kwargs.get("colleur"))