[Fixed]-Download Images from CSV column to Django ImageField

1👍

You can do

import urllib
from urlparse import urlparse
from django.core.files import File

#code
result = urllib.urlretrieve(row['image'])
filename = urlparse(row['image']).path.split('/')[-1]

img.image.save(
        filename,
        File(open(result[0]))
        )
img.save()

Leave a comment