fixes
[wolnelektury.git] / src / chunks / views.py
diff --git a/src/chunks/views.py b/src/chunks/views.py
new file mode 100644 (file)
index 0000000..e126c93
--- /dev/null
@@ -0,0 +1,9 @@
+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)
+