Wednesday, May 15, 2013

Insert multiple images in the same register in GridFS

Hi

In my Django application and I am mongodb insert photos in GridFS from mongo.
Enter only one photo in a record, everything ok.

Now when I want to enter more than one, I'm not getting. I'm set as a list, but it gives error.
I'm doing this test to start:

Painting class (Document):
     Stringfield artist = ()
     photo = ListField (FileField ())

my_painting = Painting (artist = 'Steve')
my_painting.photo = open ('C :/ BD.JPG', 'r')
my_painting.save ()

But it gives me the following error: ValidationError (Only lists and tuples may be used in the field list: ['photo'])
Yes, I realize that I can only insert lists or tuples in a field list field ... but I do not understand how to do it?
Someone can help me?

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate