missing import, and add /public/ to the start of the url

This commit is contained in:
Thomas Steen Rasmussen 2017-02-19 14:04:31 +01:00
parent 56d8a9765d
commit 3e7b85c53f
1 changed files with 3 additions and 1 deletions

View File

@ -10,6 +10,8 @@ from django.views import View
from django.views.decorators.http import require_safe
from django.http import Http404
from django.utils.decorators import method_decorator
from django.http import HttpResponse
@method_decorator(require_safe, name='dispatch')
class SpeakerPictureView(CampViewMixin, DetailView):
@ -34,7 +36,7 @@ class SpeakerPictureView(CampViewMixin, DetailView):
# (this works for nginx only, other webservers use x-sendfile),
# TODO: what about runserver mode here?
response = HttpResponse()
response['X-Accel-Redirect'] = '/_media/speakers/%(campslug)s/%(speakerslug)s/%(filename)s' % {
response['X-Accel-Redirect'] = '/public/speakers/%(campslug)s/%(speakerslug)s/%(filename)s' % {
'campslug': self.camp.slug,
'speakerslug': self.get_object().slug,
'filename': picture.name