Fix pools for organizers, broken links

This commit is contained in:
Yohann D'ANELLO 2020-05-05 13:13:43 +02:00
parent 12e4222393
commit cb7c23fd68
3 changed files with 8 additions and 6 deletions

View File

@ -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()

View File

@ -12,7 +12,7 @@ DATABASES = {
}
# Break it, fix it!
DEBUG = True
DEBUG = False
# Mandatory !
ALLOWED_HOSTS = ['inscription.tfjm.org']

View File

@ -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/<str:file>/", DocumentView.as_view(), name="document"),
path('api/', include('api.urls')),
]
urlpatterns += [
re_path(r'^%s(?P<path>.*)$' % 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