fix speaker pictures

This commit is contained in:
Thomas Steen Rasmussen 2017-02-19 18:17:56 +01:00
parent 9092af2b49
commit 9334f51c9a

View file

@ -12,7 +12,6 @@ from django.http import Http404
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.http import HttpResponse from django.http import HttpResponse
@method_decorator(require_safe, name='dispatch') @method_decorator(require_safe, name='dispatch')
class SpeakerPictureView(CampViewMixin, DetailView): class SpeakerPictureView(CampViewMixin, DetailView):
model = models.Speaker model = models.Speaker
@ -25,8 +24,8 @@ class SpeakerPictureView(CampViewMixin, DetailView):
else: else:
raise Http404() raise Http404()
elif kwargs['picture'] == 'large': elif kwargs['picture'] == 'large':
if self.get_object().picture_small: if self.get_object().picture_large:
picture = self.get_object().picture_small picture = self.get_object().picture_large
else: else:
raise Http404() raise Http404()
else: else:
@ -39,8 +38,9 @@ class SpeakerPictureView(CampViewMixin, DetailView):
response['X-Accel-Redirect'] = '/public/speakers/%(campslug)s/%(speakerslug)s/%(filename)s' % { response['X-Accel-Redirect'] = '/public/speakers/%(campslug)s/%(speakerslug)s/%(filename)s' % {
'campslug': self.camp.slug, 'campslug': self.camp.slug,
'speakerslug': self.get_object().slug, 'speakerslug': self.get_object().slug,
'filename': picture.name 'filename': os.path.basename(picture.name),
} }
response['Content-Type'] = ''
return response return response