Thursday, 15 July 2010

django - Mongoengine delete file gridfs -


I am using Mongoengine to incorporate images into the gridfest of the songguns. Everything is fine, but I want to remove now, and I can not find it. I am using version 0.8.2 and I am a Mongoise to do this:

  class animal (document): genus = stringfield () family = stringfield () photo = filefield () Marmot = Animals (genus = 'marmotta') marmot.photo.delete ()   

Only he did not remove anything or gave the error. What am I doing wrong? Can anyone help me?

I have managed to delete it, like this:

  Marmot = Animal.objects.get (id = '51c80fb28774a715dc0481ae') marmot.photo.delete () The issue is that I am uploading to GridFS with the following code: If request. Method == 'POST': My_painting = Movie.objects.get (id = id) A files = [] Request a f [f] for a. Getlist ('file'): a mf = mongoengine.fields.GridFSProxy () a mf.put (f, filename = f.name, legend = 'Oi') One Files.append (mf) One print files my_painting.MovieCover The files include a my_painting.save ()   

properly

but when I delete, I get the following error from the above given experiment: There is no attribute in the 'basilist' object altitude '

Can someone help me?

No comments:

Post a Comment