X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/357027375ff8867f42ca34bcbfb5a78b5b185fc3..a9226097c8eea0591fd3249f62a71becc6d2be93:/src/chunks/views.py?ds=sidebyside diff --git a/src/chunks/views.py b/src/chunks/views.py index cbcf5bf6c..e126c9304 100644 --- a/src/chunks/views.py +++ b/src/chunks/views.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.http import HttpResponse -from ssify import ssi_included -from .models import Chunk +from django.shortcuts import get_object_or_404 +from . import models +from fnpdjango.utils.views import serve_file + + +def attachment(request, key, ext): + att = get_object_or_404(models.Attachment, key=key) + return serve_file(att.attachment.url) -@ssi_included -def chunk(request, key): - chunk, created = Chunk.objects.get_or_create(key=key) - return HttpResponse(chunk.content)