title: AssertionError: Class UserSerializer missing "Meta" attribute while performing User Accounts Management on Django
body: <p>my views.py file:</p>
  <pre><code>from rest_framework.views import APIView
  from rest_framework.response import Response
  from .serializers import UserSerializer
  
  
  class TestView(APIView):
      def get(self, request, format=None):
          print(&quot;API called&quot;)
          return Response(&quot;You did it!&quot;, status=200)
  
  
  class UserView(APIView):
      def post(self, request, format=None):
          print(&quot;User created&quot;)
  
          user_data = request.data
          print(request.data)
          user_serializer = UserSerializer(data=user_data)
          if user_serializer.is_valid(raise_exception=False):
              user_serializer.save()
              return Response({'user': user_data}, status=200)
  
          return Response({'msg': &quot;error: no user created&quot;}, status=400)
  
  </code></pre>
  <p>my serializers.py file:</p>
  <pre><code>from rest_framework import serializers
  from django.contrib.auth.models import User
  from rest_framework.validators import UniqueValidator
  from rest_framework.settings import api_settings
  
  
  class UserSerializer(serializers.ModelSerializer):
  
      token = serializers.SerializerMethodField()
  
      email = serializers.EmailField(
          required=True,
          validators=[UniqueValidator(queryset=User.objects.all())]
      )
  
      username = serializers.CharField(
          required=True,
          max_length=32,
          validators=[UniqueValidator(queryset=User.objects.all())]
      )
  
      first_name = serializers.CharField(
          required=True,
          max_length=32
      )
  
      last_name = serializers.CharField(
          required=True,
          max_length=32
      )
  
      password = serializers.CharField(
          required=True,
          min_length=8,
          write_only=True
      )
  
      def create(self, validated_data):
          password = validated_data.pop(password, None)
          instance = self.Meta.model(**validated_data)
          if password is not None:
              instance.set_password(password)
          instance.save()
          return instance
  
      def get_token(self, obj):
          jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
          jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER
          payload = jwt_payload_handler(obj)
          token = jwt_encode_handler(payload)
          return token
  
  
  class Meta:
      model = User
      fields = (
          'token'
          'username',
          'password',
          'first_name',
          'last_name',
          'email',
          'id'
      )
  </code></pre>
  <p>my urls.py file:</p>
  <pre><code>from django.urls import path
  from .views import TestView, UserView
  from rest_framework_jwt.views import refresh_jwt_token, verify_jwt_token
  
  urlpatterns = [
      path('test', TestView.as_view()),
      path('user-view/', UserView.as_view()),
  ]
  </code></pre>
  <p>Postman request:</p>
  <p><a href="https://i.stack.imgur.com/jyRIO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jyRIO.png" alt="" /></a></p>
  <p>as you can see, i'm sending a username here. I know it will give error because I'm not sending the complete data with all the fields, however the error i do get is completely different</p>
  <p>and then this is my cmd:</p>
  <p><a href="https://i.stack.imgur.com/6pEtN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6pEtN.png" alt="" /></a></p>
  <p>You can see the server runs without errors, but I keep getting an assertion error even though the class Meta is there. Please help me resolve the error!</p>
  <p>P.S. I don't know if it matters but the frontend is on react-native and is unintegrated at the moment.</p>