title: Save image from URL with serializer
body: <p>I am creating an API that saves images in a django model. Through the API is sent a URL and django is responsible for downloading the image and saving it in the model.</p>
  
  <p>This is my model:</p>
  
  <pre><code>class Picture(Media):
      image = models.ImageField(upload_to=picture_path, blank=True, null=True)
      entity = models.CharField(max_length=20, choices=ENTITIES,
                            default=ENTITY_CLASIFICADO)
  </code></pre>
  
  <p>This is my serializer:</p>
  
  <pre><code>class PictureSerializer(serializers.ModelSerializer):
      image = serializers.ImageField(max_length=None, use_url=True)
  
      class Meta:
          model = Picture
          fields = ("pk", "image", "entity",)
  </code></pre>
  
  <p>From the URL I generate a PIL object. How do I specify the serializer that stores the object? My views.py</p>
  
  <pre><code>class PictureViewSet(generics.ListCreateAPIView):
      def create(self, request, *args, **kwargs):
          r = requests.get(request.data["url"])
          img_temp = NamedTemporaryFile(delete = True)
          img_temp.write(r.content)
  </code></pre>
  
  <p>Now, I'm saving the empty image field.</p>
  
  <pre><code>serializer = self.get_serializer(data=request.data)
  </code></pre>
  
  <p>I would like to add the PIL object to request.data and it looks like this:</p>
  
  <pre><code>&lt;QueryDict: {'url': ['https://s3.amazonaws.com/cat/encabezado.jpg'], 'image': ['MY PIL IMAGE'], 'entity': ['clasificado'], 'csrfmiddlewaretoken': ['JRMLIXkxqg6sF5YP19NLTvgFOmVWH9ARSmM']}&gt;
  </code></pre>
  
  <p>Thanks!</p>