mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 17:02:24 +00:00
404 error rather than 403 when media is not found
This commit is contained in:
parent
0b48c0fa95
commit
b16fe7d68e
@ -4,7 +4,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db.models import Q
|
||||
from django.http import FileResponse
|
||||
from django.http import FileResponse, Http404
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
@ -188,7 +188,11 @@ class DocumentView(LoginRequiredMixin, View):
|
||||
"""
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
doc = Document.objects.get(file=self.kwargs["file"])
|
||||
try:
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user