dbstorage/dbfilestorage/views.py

12 lines
289 B
Python
Raw Normal View History

2016-12-07 20:05:14 +00:00
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from .models import DBFile
def show_file(request, name):
dbf = get_object_or_404(DBFile, name=name)
return HttpResponse(
dbf.b64.decode('base64'),
content_type=dbf.content_type)