title: {"username":["This field is required."]}
body: <p>Stuck with the error here. Works fine with the get request in angular but create problem while using post request. So guys help me. And thanks in advance guys.   </p>
  
  <p><strong>serializers.py</strong></p>
  
  <pre><code>from django.contrib.auth.models import User
  from rest_framework import serializers
  
  
  class UserSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = User
          fields = ('id', 'username', 'email', 'password')
          extra_kwargs = {'password': {'write_only': True}}
  
      def create(self, validated_data):
          """ Create and return a new user"""
  
          user = User.objects.create_user(**validated_data)
          return user
  </code></pre>
  
  <p><strong>view.py</strong></p>
  
  <pre><code>from django.contrib.auth.models import User
  from rest_framework import viewsets
  
  from .serializers import UserSerializer
  
  
  class UserViewSet(viewsets.ModelViewSet):
      """ API endpoint that allows users to be viewed or edited. """
  
      serializer_class = UserSerializer
      queryset = User.objects.all()
  </code></pre>
  
  <p><strong>register/urls.py</strong></p>
  
  <pre><code>from django.urls import path, include
  from rest_framework import routers
  
  from . import views
  
  router = routers.DefaultRouter()
  router.register('users', views.UserViewSet)
  
  
  # Wire up our API using automatic URL routing.
  # Additionally, we include login URLs for the browsable API.
  
  urlpatterns = [
      path('', include(router.urls)),
  ]
  </code></pre>
  
  <p><strong>django/urls.py</strong></p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path, include
  
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('api/', include('register.urls')),
  ]
  </code></pre>
  
  <p><strong>error</strong></p>
  
  <p><a href="https://i.stack.imgur.com/JcV3Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JcV3Q.png" alt="enter image description here"></a></p>