title: How to update profile pic in DRF
body: <p>I have created an api where one can upload pic for profile along with rest of the details. My problem is that if one wants to change the pic, how can it be done.
  At present, I am able to save pic for the first time.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Profile(models.Model):
      User = get_user_model()
      branch = models.CharField(max_length=20, null=True)
      year = models.IntegerField(null=True)
      image = models.ImageField(upload_to="accounts/images/", null=True, blank=True)
      user = models.OneToOneField(
          User,
          on_delete=models.CASCADE,
          primary_key=False,
          null=True
      )
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class ProfileView(APIView):
  
      permission_classes = (IsAuthenticated,)
      serializer_class = ProfileSerializer
      queryset = Profile.objects.all()
  
      def post(self, request, format=None):
          current_user = request.user
          param = request.data
          profile = Profile.objects.filter(user=current_user.pk)
          if profile:
              serializer = ProfileSerializer(profile, many=True)
              return Response(serializer.data)
          else:
              serializer = ProfileSerializer(data=param)
              if serializer.is_valid(raise_exception=True):
                  serializer.save(user=current_user)
                  new_data = serializer.data
                  return Response(new_data)
              return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)
  </code></pre>