X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..1536f4b129950f206b7ffabb38805d0e1dd47661:/src/chunks/views.py 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) +