title: API endpoint returns TypeError: 'type' object is not iterable
body: <p>I am writing a create user API by extending the class <code>users</code> with <code>AbstractBaseUser</code> class. The API was working fine for regular <code>model fields</code> like <code>EmailField</code>, <code>CharField</code>, <code>BooleanField</code>. But then I decided to store the <code>profile_picture</code> of users as well. So I create a new field <code>profile_picture</code> as <code>ImageField</code> to store the path of user's profile picture in the same extended <code>users</code> model.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Users(AbstractBaseUser, PermissionsMixin):
  
      """
      This model is used to store user login credential and profile information.
      It's a custome user model but used for Django's default authentication.
      """
  
      email = models.EmailField(max_length=255, unique=True)
      first_name = models.CharField(max_length=255, blank=False, null=False)
      last_name = models.CharField(max_length=255, blank=False, null=False)
      profile_picture = models.ImageField(upload_to='Images/', max_length=None, blank=True)
      is_active = models.BooleanField(default=True)
  
      # defing a custome user manager class for the custome user model.
      objects = managers.UserManager()
  
      # using email a unique identity for the user and it will also allow user to use email while logging in.
      USERNAME_FIELD = 'email'
  </code></pre>
  
  <p>Then I updated  <code>UserAPIView</code> class to add <code>parser_classes = (FileUploadParser)</code></p>
  
  <p><strong>view.py</strong></p>
  
  <pre><code>from django.shortcuts import render
  from . import views
  from rest_framework.views import APIView
  from django.db import IntegrityError
  from rest_framework import status
  from . import models, serializers
  from rest_framework.response import Response
  from django.core.mail import send_mail
  from rest_framework.parsers import FileUploadParser
  
  
  
  class UserAPIViews(APIView):
      """
      """
  
      parser_classes = (FileUploadParser)
  
      def post(self, request, format=None):
          """
          """
          print(request.data)
          serialized_data = serializers.UserSerializer(data=request.data)
          if serialized_data.is_valid():
  
              try:
                  user_id = serialized_data.save()
              except IntegrityError as error:
                  message = f"Email already exist."
                  return Response ({
                      'error_message' : message,
                      'status' : status.HTTP_226_IM_USED
                  })
  
              subject = 'Eitan - Case Manager Account Credentials'
              body = f"Hi {serialized_data.validated_data.get('first_name')} Your case manager account is ready. Please use following credentials to login. Email - {serialized_data.validated_data.get('email')}, Password - {serialized_data.validated_data.get('password')} Thank You! Team Eitan."
              sender = "steinnlabs@gmail.com"
              to = serialized_data.validated_data.get('email')
  
              send_mail(subject, body, sender, [to], fail_silently=False)
  
              success_message = f"User has been created."
  
              return Response({
                  'success_message' : success_message,
                  'status' : status.HTTP_201_CREATED
              })
  
          else:
              return Response (serialized_data.error_messages)
  </code></pre>
  
  <p>Updated <code>settings.py</code> to add <code>MEDIA_ROOT</code> and <code>MEDIA_URL</code></p>
  
  <p><strong>settings.py</strong></p>
  
  <pre><code># Image upload configurations
  MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  MEDIA_URL = '/media/
  </code></pre>
  
  <p>Now, when I try to hit the end point at <code>http://127.0.0.1:8000/user/create/</code> it returns -</p>
  
  <pre><code>TypeError at /user/create/
  'type' object is not iterable
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/CnZcV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CnZcV.png" alt="error image"></a></p>