title: How to save an image from Google Places API to an ImageField in a Django app?
body: <p>I'm building population code to populate Django model 'City' with images from Google Places API.</p>
  
  <p>This is the model:</p>
  
  <pre><code>class City(models.Model):
      city_image = models.ImageField(blank=True, upload_to='city_pictures')
  </code></pre>
  
  <p>I built the API URL that returns a photo:</p>
  
  <pre><code>#fetch image from this url
          city_image_url = ('https://maps.googleapis.com/maps/api/place/photo'
          '?maxwidth=%s'
          '&amp;photoreference=%s'
          '&amp;key=%s') % (maxwidth, city_image_ref, GoogleKey)
  </code></pre>
  
  <p>Google says the response is a photo and I tested that on Postman so I want to so something like this:</p>
  
  <pre><code>with urllib.request.urlopen(city_image_url) as response:
              city_image = response
  created_city = City.objects.get_or_create(city_id=city_id)[0]
  created_city.city_image = city_image 
  #plus other fields
  </code></pre>
  
  <p>But I receive this error:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "C:\Users\bnbih\Djangos\excurj_proj\population_script.py", line 68, in 
        populate()
      File "C:\Users\bnbih\Djangos\excurj_proj\population_script.py", line 64, in populate
        created_city.save()
      File "C:\Users\bnbih\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 796, in save
        force_update=force_update, update_fields=update_fields)
      File "C:\Users\bnbih\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 824, in save_base
        updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
      File "C:\Users\bnbih\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 886, in _save_table
        for f in non_pks]
      File "C:\Users\bnbih\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 886, in 
        for f in non_pks]
      File "C:\Users\bnbih\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\fields\files.py", line 290, in pre_save
        if file and not file._committed:
    AttributeError: 'HTTPResponse' object has no attribute '_committed'</p>
  </blockquote>
  
  <p>I'm using Python 3 and Django 1.10</p>