Compare commits

..

2 Commits

Author SHA1 Message Date
Yohann D'ANELLO b16fe7d68e 404 error rather than 403 when media is not found 2020-05-23 12:23:03 +02:00
Yohann D'ANELLO 0b48c0fa95 Display real solutions deadline 2020-05-23 12:19:14 +02:00
2 changed files with 7 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.db.models import Q from django.db.models import Q
from django.http import FileResponse from django.http import FileResponse, Http404
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone from django.utils import timezone
@ -188,7 +188,11 @@ class DocumentView(LoginRequiredMixin, View):
""" """
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
try:
doc = Document.objects.get(file=self.kwargs["file"]) doc = Document.objects.get(file=self.kwargs["file"])
except Document.DoesNotExist:
raise Http404(_("No %(verbose_name)s found matching the query") %
{'verbose_name': Document._meta.verbose_name})
grant = request.user.admin grant = request.user.admin

View File

@ -328,7 +328,7 @@ class SolutionsView(TeamMixin, BaseFormView, SingleTableView):
self.object_list = self.get_queryset() self.object_list = self.get_queryset()
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["now"] = timezone.now() context["now"] = timezone.now()
context["real_deadline"] = self.request.user.team.tournament.date_solutions + timedelta(minutes=30) context["real_deadline"] = self.request.user.team.future_tournament.date_solutions + timedelta(minutes=30)
return context return context
def get_queryset(self): def get_queryset(self):