From cb7c23fd68a7edee5b05e1ae3639ac936e481ff8 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 5 May 2020 13:13:43 +0200 Subject: [PATCH] Fix pools for organizers, broken links --- apps/tournament/views.py | 4 ++-- tfjm/settings_prod.py | 2 +- tfjm/urls.py | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/tournament/views.py b/apps/tournament/views.py index f957d45..c46b08a 100644 --- a/apps/tournament/views.py +++ b/apps/tournament/views.py @@ -424,7 +424,7 @@ class PoolListView(LoginRequiredMixin, SingleTableView): qs = super().get_queryset() user = self.request.user if not user.admin and user.organizes: - qs = qs.filter(Q(jurys=user) | Q(solutions__tournament__organizers=user)) + qs = qs.filter(Q(juries=user) | Q(teams__tournament__organizers=user)) elif user.participates: qs = qs.filter(teams=user.team) return qs.distinct() @@ -447,7 +447,7 @@ class PoolDetailView(LoginRequiredMixin, DetailView): qs = super().get_queryset() user = self.request.user if not user.admin and user.organizes: - qs = qs.filter(Q(jurys=user) | Q(solutions__tournament__organizers=user)) + qs = qs.filter(Q(juries=user) | Q(solutions__tournament__organizers=user)) elif user.participates: qs = qs.filter(teams=user.team) return qs.distinct() diff --git a/tfjm/settings_prod.py b/tfjm/settings_prod.py index 0204ed3..a9dd4d2 100644 --- a/tfjm/settings_prod.py +++ b/tfjm/settings_prod.py @@ -12,7 +12,7 @@ DATABASES = { } # Break it, fix it! -DEBUG = True +DEBUG = False # Mandatory ! ALLOWED_HOSTS = ['inscription.tfjm.org'] diff --git a/tfjm/urls.py b/tfjm/urls.py index c5cfc02..1df5615 100644 --- a/tfjm/urls.py +++ b/tfjm/urls.py @@ -20,7 +20,7 @@ from django.contrib import admin from django.contrib.staticfiles.views import serve from django.urls import path, include, re_path from django.views.defaults import bad_request, permission_denied, page_not_found, server_error -from django.views.generic import TemplateView +from django.views.generic import TemplateView, RedirectView from member.views import DocumentView @@ -37,10 +37,12 @@ urlpatterns = [ path("media//", DocumentView.as_view(), name="document"), path('api/', include('api.urls')), -] -urlpatterns += [ re_path(r'^%s(?P.*)$' % re.escape(settings.STATIC_URL.lstrip('/')), serve), + + # Supporting old paths + path('inscription/', RedirectView.as_view(pattern_name="member:signup")), + path('connexion/', RedirectView.as_view(pattern_name="login")), ] handler400 = bad_request