Gitlab CSE Unil

Commit b450c1af authored by Julien Furrer's avatar Julien Furrer
Browse files

Add cache control to send image

parent 2b49e6dd
...@@ -7,6 +7,7 @@ from django.http.response import HttpResponse, HttpResponseBadRequest, HttpRespo ...@@ -7,6 +7,7 @@ from django.http.response import HttpResponse, HttpResponseBadRequest, HttpRespo
from django.shortcuts import render, get_object_or_404 from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
from django.views.decorators.cache import cache_control
from PIL import Image from PIL import Image
from adim.models import AnObj from adim.models import AnObj
from .forms import UploadImageFileForm from .forms import UploadImageFileForm
...@@ -68,6 +69,7 @@ def _get_anobj(request, anobj_uuid=None, anobj_id=None): ...@@ -68,6 +69,7 @@ def _get_anobj(request, anobj_uuid=None, anobj_id=None):
@login_required @login_required
@cache_control(public=True, max_age=120)
def send_anobj_img(request, anobj_uuid): def send_anobj_img(request, anobj_uuid):
try: try:
anobj = _get_anobj(request, anobj_uuid=anobj_uuid) anobj = _get_anobj(request, anobj_uuid=anobj_uuid)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment