Update to the list of images
Hi
My problem is this, I have a field that is a list of ids of the images stored in a register.
The issue is that I want to insert an image, and then later want to add another image over it erases the list and put there just the id of this image saved now, and I wanted to update the list, leaving the id that there was and added the new.
My code is this:
def uploadEquipment (request, id):
if request.method == 'POST':
my_painting Club.objects.get = (id = id)
print my_painting.equipment
files = []
request.FILES.getlist for f in ('file'):
# ------------ guard file in GridFS
mf = mongoengine.fields.GridFSProxy ()
mf.put (f, filename = f.name, legend = 'Hi')
# -----------------
files.append (mf) # update the list
my_painting.equipment = files
my_painting.save ()
Someone can help me how to do this?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home