Image upload on record that already exists
Hi
I'm doing a test to insert images in mongodb with GridFS.
I am using mongoengine.
I have this code:
def index (request):
if request.method == 'POST':
MovieTitle = 'Avatar'
Movie movie = (= movieTitle movieTitle)
my_painting = Movie (movieTitle = movieTitle)
my_painting.MovieCover request.FILES = ['file']
my_painting.save ()
return render_to_response ('index.html', {},
context_instance = RequestContext (request))
So far so good, he enters the Avatar movie, and upload the image properly to GridFS from mongo.
But if I now enter another photo as you want this same movie Avatar, and do so:
def index (request):
if request.method == 'POST':
Movie movie = (id = '518b5ec58774a7100c7803e1 ')
my_painting = Movie (id = '518b5ec58774a7100c7803e1 ')
my_painting.MovieCover request.FILES = ['file']
my_painting.save ()
return render_to_response ('index.html', {},
context_instance = RequestContext (request))
He inserts a new record with that id, and that id is related to the previous film already inserted.
Does anyone know what I'm doing wrong?
-- 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