class CachedImage(models.Model):
    url = models.CharField(max_length=255, unique=True)
photo = models.ImageField(upload_to=photo_path, blank=True)

def cache(self):
    """Store image locally if we have a URL"""
if self.url and not self.photo:
    result = urllib.request.urlretrieve(self.url)
self.photo.save(os.path.basename(self.url), File(open(result[0], 'rb')))
self.save()
Programmatically saving image to Django ImageField