django ,image field,local file~
如果我想用本地图片帮定到django models的imagefield,要怎么做?
如下:
from django.core.files import File
img = File(open(your_local_image_file))
s = some_model.create(image = img)
s.save()
img = File(open(your_local_image_file))
s = some_model.create(image = img)
s.save()
即可~!