from rest_framework import serializers
from django.contrib.auth.models import User


class UserSerializer(serializers.HyperlinkedModelSerializer):
    """ Serializer for a User
    """

    class Meta:
        model = User
        fields = ('username',
                  'first_name',
                  'last_name',
                  'email',)

from rest_framework import serializers
from django.contrib.auth.models import User


class UserSerializer(serializers.HyperlinkedModelSerializer):
    """ Serializer for a User
    """

    class Meta:
        model = User
        fields = ('pk',
                  'username',
                  'first_name',
                  'last_name',
                  'email',)

Include PK in user serializer
Include PK in user serializer

  from rest_framework import serializers
  from django.contrib.auth.models import User
  
  
  class UserSerializer(serializers.HyperlinkedModelSerializer):
      """ Serializer for a User
      """
  
      class Meta:
          model = User
-         fields = ('username',
+         fields = ('pk',
+                   'username',
                    'first_name',
                    'last_name',
                    'email',)
  
Include PK in user serializer
## Code Before:
from rest_framework import serializers
from django.contrib.auth.models import User


class UserSerializer(serializers.HyperlinkedModelSerializer):
    """ Serializer for a User
    """

    class Meta:
        model = User
        fields = ('username',
                  'first_name',
                  'last_name',
                  'email',)

## Instruction:
Include PK in user serializer
## Code After:
from rest_framework import serializers
from django.contrib.auth.models import User


class UserSerializer(serializers.HyperlinkedModelSerializer):
    """ Serializer for a User
    """

    class Meta:
        model = User
        fields = ('pk',
                  'username',
                  'first_name',
                  'last_name',
                  'email',)
