-# -*- 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)