from handover_api.models import Handover, Draft, User
from rest_framework import serializers


class HandoverSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Handover
        fields = ('project_id','from_user_id','to_user_id','state')


class DraftSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Draft
        fields = ('project_id','from_user_id','to_user_id','state')


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('dds_id', 'api_key')
from handover_api.models import Handover, Draft, User
from rest_framework import serializers


class HandoverSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Handover
        fields = ('id','url','project_id','from_user_id','to_user_id','state')


class DraftSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Draft
        fields = ('id','url','project_id','from_user_id','to_user_id','state')


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('id','url','dds_id', 'api_key')
Include id and url in models
Include id and url in models

  from handover_api.models import Handover, Draft, User
  from rest_framework import serializers
  
  
  class HandoverSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Handover
-         fields = ('project_id','from_user_id','to_user_id','state')
+         fields = ('id','url','project_id','from_user_id','to_user_id','state')
  
  
  class DraftSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Draft
-         fields = ('project_id','from_user_id','to_user_id','state')
+         fields = ('id','url','project_id','from_user_id','to_user_id','state')
  
  
  class UserSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = User
-         fields = ('dds_id', 'api_key')
+         fields = ('id','url','dds_id', 'api_key')
Include id and url in models
## Code Before:
from handover_api.models import Handover, Draft, User
from rest_framework import serializers


class HandoverSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Handover
        fields = ('project_id','from_user_id','to_user_id','state')


class DraftSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Draft
        fields = ('project_id','from_user_id','to_user_id','state')


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('dds_id', 'api_key')
## Instruction:
Include id and url in models
## Code After:
from handover_api.models import Handover, Draft, User
from rest_framework import serializers


class HandoverSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Handover
        fields = ('id','url','project_id','from_user_id','to_user_id','state')


class DraftSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Draft
        fields = ('id','url','project_id','from_user_id','to_user_id','state')


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('id','url','dds_id', 'api_key')