move editor to new django app
This commit is contained in:
parent
5bdbfb934c
commit
470815c859
11 changed files with 85 additions and 39 deletions
|
@ -1,20 +0,0 @@
|
|||
import mimetypes
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.admin.views.decorators import staff_member_required
|
||||
from django.core.files import File
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from .models import Source
|
||||
|
||||
|
||||
@staff_member_required
|
||||
def source(request, source):
|
||||
source = get_object_or_404(Source, name=source)
|
||||
response = HttpResponse(content_type=mimetypes.guess_type(source.name)[0])
|
||||
image_path = os.path.join(settings.MAP_ROOT, source.package.directory, 'sources', source.name)
|
||||
for chunk in File(open(image_path, 'rb')).chunks():
|
||||
response.write(chunk)
|
||||
return response
|
Loading…
Add table
Add a link
Reference in a new issue