X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b2d342589a7889a3b096e7192453d53bd28eed7d..9c2555ad140dca1c09cde628bd22aac811e05b7e:/src/chunks/views.py?ds=inline diff --git a/src/chunks/views.py b/src/chunks/views.py index fe62ed14f..e126c9304 100644 --- a/src/chunks/views.py +++ b/src/chunks/views.py @@ -1,13 +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 -@ssi_included -def chunk(request, key): - chunk, created = Chunk.objects.get_or_create(key=key) - return HttpResponse(chunk.content) +def attachment(request, key, ext): + att = get_object_or_404(models.Attachment, key=key) + return serve_file(att.attachment.url) +