okay
I'm doing the following to insert the files in GridFS:
def upload(request, id):
if request.method == 'POST':
movie = Movie.objects(id=id)
my_painting = Movie(id=id)
files = []
for f in request.FILES.getlist('file'):
mf = mongoengine.fields.GridFSProxy()
mf.put(f, filename=f.name, legend='Oi') files.append(mf)
my_painting.MovieCover = files
my_painting.save()
And I'm going to do this to recover the files:
def view(request, id):
fs = mongoengine.fields.GridFSProxy()
foto = fs.get(id=ObjectId(id)).read()
return HttpResponse(foto, content_type='image/jpeg')
If I recover the legend as you want to enter as I do?