For some reason, _clean_photo is being given the last image name for
dataName, and that's why only the last picture is being validated.
The line of code that calls _clean_photo with the image name is:
setattr(new_form, 'clean_' + image_name, lambda self: self._clean_photo
(image_name))
This line is within the make_image_form method:
for image_name in image_fields:
print "image name is: ", image_name
setattr(new_form, 'clean_' + image_name, lambda self:
self._clean_photo(image_name))
You can see that I'm printing the image name. The image_name is
changing, but it looks like only the final image_name is used (which
will of course be the last image). Why would this be happening? All
of the clean methods are generated correctly (e.g. clean_pic_1,
clean_pic_2....)
Is there something to do with lambda expressions that I'm missing?
Thanks,
Louis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---