Using Photologist, I can upload images as part of the form without any problems. However, in test plans, itβs hard for me to get an image for verification.
In the tests.py file:
data_photo = {'competition': self.newcomp,
'title': 'Rabbit',
'image': open('photocompetitions/static/img/body_bg.jpg'),
'flickr_id': '425258',
'description': 'A picture of a rabbit',
'location': 'POINT (5000 5000)',
'location_description': 'Just some random place',
'copyright': 'Copyright 2011'}
photoform = PhotoForm(data_photo)
Everything works fine, except for the "image" field, which fails because "this field is required." therefore, I assume that it is not accepted, despite the open () command. the βimageβ field is a photograph of the ImageModel model and appears on the site as a standard upload form.
source
share