Verified Commit a95f741f authored by Jake Howard's avatar Jake Howard
Browse files

add view for file thumbnail in admin

parent 0cb925bd
......@@ -40,3 +40,11 @@ def file_download(request, id, token):
def hotlink_file_download(request, id):
file = get_object_or_404(SharedFile, short_id=id, hotlink=True, published=True)
return FileResponse(file)
def uploaded_file(request, filename):
file = get_object_or_404(SharedFile, file=request.get_full_path()[1:]) # strip preceding slash
response = FileResponse(file)
del response['Content-Disposition']
return response
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from project.files import views
from project.files.views import uploaded_file
urlpatterns = [
url(r'^admin/', include(,
url(r'^admin_resumable/', include('admin_resumable.urls')),
url(r'^files/', include('project.files.urls', namespace="files"))
url(r'', include("project.pages.urls", namespace="pages")),
url(r'^files/', include('project.files.urls', namespace="files")),
url(r'^uploads/(?P<filename>.*)', uploaded_file, name="upload"),
url(r'', include("project.pages.urls", namespace="pages"))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment