BTW, ignore the PIL imports On Sep 15, 12:28 pm, Yo-Yo Ma <baxterstock...@gmail.com> wrote: > I think it might be a good idea to document the direct usage of the > FileField, and ImageField model fields. > > The docs make the assumption that everyone is using ModelForm to > upload files. If I have a file on my hard drive and want to use it to > populate the field, I would try something like: > > from PIL import Image, ImageFile > image = open('/some/path/to/image.jpg', 'rb') > > instance = MyModel( > image=image, > title="Hello, World." > ) > > instance.save() > > The docs show examples of how to manually use models, but don't give > any examples of how to do this when an image, or file is included in > the mix.
-- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.