Remove unused cache on attachment urls
This commit is contained in:
parent
d7a7e65805
commit
89ed178b6a
2 changed files with 0 additions and 12 deletions
|
@ -34,7 +34,6 @@ def test_view_original(attachment: Attachment, client: Client) -> None:
|
|||
res = client.get(url)
|
||||
assert res.status_code == 302
|
||||
assert res.url == attachment.original_file.url
|
||||
assert "Last-Modified" in res.headers
|
||||
|
||||
|
||||
def test_view_processed(attachment: Attachment, client: Client) -> None:
|
||||
|
@ -42,4 +41,3 @@ def test_view_processed(attachment: Attachment, client: Client) -> None:
|
|||
res = client.get(url)
|
||||
assert res.status_code == 302
|
||||
assert res.url == attachment.processed_file.url
|
||||
assert "Last-Modified" in res.headers
|
||||
|
|
|
@ -1,25 +1,15 @@
|
|||
import datetime
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.views.decorators.http import last_modified
|
||||
|
||||
from attachments.models import Attachment
|
||||
|
||||
|
||||
def get_updated_at(request: WSGIRequest, pk: int) -> datetime.datetime:
|
||||
attachment = get_object_or_404(Attachment, pk=pk)
|
||||
return attachment.updated_at
|
||||
|
||||
|
||||
@last_modified(get_updated_at)
|
||||
def get_original(request: WSGIRequest, pk: int) -> HttpResponse:
|
||||
attachment = get_object_or_404(Attachment, pk=pk)
|
||||
return HttpResponseRedirect(attachment.original_file.url)
|
||||
|
||||
|
||||
@last_modified(get_updated_at)
|
||||
def get_processed(request: WSGIRequest, pk: int) -> HttpResponse:
|
||||
attachment = get_object_or_404(Attachment, pk=pk)
|
||||
return HttpResponseRedirect(attachment.processed_file.url)
|
||||
|
|
Reference in a new issue