dbstorage/dbfilestorage/views.py
2016-12-07 15:57:24 -05:00

12 lines
289 B
Python

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)