Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django test imagefield

from django.core.files.uploadedfile import SimpleUploadedFile

newPhoto.image = SimpleUploadedFile(name='test_image.jpg', content=open(image_path, 'rb').read(), content_type='image/jpeg')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #test #imagefield
ADD COMMENT
Topic
Name
9+6 =