title: django/rest: Can I have serializer with only one field?
body: <p>I'm using <code>django 1.11.5</code> and python 3.5. </p>
  
  <p>Using <code>rest-framework</code>, I want to search a patient having <code>uid</code>.</p>
  
  <p>When I'm trying to have a serializer with only one field I get the error <code>The</code>fields<code>option must be a list or tuple or "__all__". Got str.</code>.</p>
  
  <p>Is there any solution to have only one field to search a user?</p>
  
  <p>serializers.py</p>
  
  <pre><code>class GetUserSerializer(serializers.ModelSerializer):
      id = serializers.CharField(source='uid')
  
      class Meta:
          model = User
          fields = ('id')
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>class GetUser(CreateAPIView):
      permission_classes = ()
      serializer_class = GetUserSerializer
  
      def get(self, request):
          serializer = GetUserSerializer(data=request.data)
          # Check format and unique constraint
          if not serializer.is_valid():
              return Response(serializer.errors, \
                              status=status.HTTP_400_BAD_REQUEST)
          data = serializer.data
  
  
          if User.objects.filter(uid = data['id']).exists():
              user = User.objects.get(uid = data['id'])
              resp = {"user":{"uid":user.uid, "firstname":user.firstname, "yearofbirth": user.yearofbirth, \
                              "lastnames": user.lastname, "othernames": user.othernames}}
              return Response(resp, status=status.HTTP_200_OK)
  
          else:
  
              resp = {"error": "User not found"}
              return Response(resp, status=status.HTTP_404_NOT_FOUND)
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>class User(models.Model):
      uid = models.CharField(max_length=255, unique=True,default="0")
      firstname = models.CharField(max_length=255)
      lastname = models.CharField(max_length=255, blank=True)
      othernames = models.CharField(max_length=255, blank=True)
      yearofbirth = models.SmallIntegerField(validators=[MinValueValidator(1900),
                                             MaxValueValidator(2018)], null = False
  </code></pre>