from rest_framework import serializers
from .models import Activity, Datapoint


class ActivitySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Activity
        fields = ('user', 'full_description', 'units', 'url')


class DatapointSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Datapoint
        fields = ('user', 'activity', 'reps', 'timestamp', 'url')

from rest_framework import serializers
from .models import Activity, Datapoint


class ActivitySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Activity
        fields = ('id', 'user', 'full_description', 'units', 'url')


class DatapointSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Datapoint
        fields = ('id', 'user', 'activity', 'reps', 'timestamp', 'url')

Add 'id' to both Serializers
Add 'id' to both Serializers

  from rest_framework import serializers
  from .models import Activity, Datapoint
  
  
  class ActivitySerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Activity
-         fields = ('user', 'full_description', 'units', 'url')
+         fields = ('id', 'user', 'full_description', 'units', 'url')
  
  
  class DatapointSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = Datapoint
-         fields = ('user', 'activity', 'reps', 'timestamp', 'url')
+         fields = ('id', 'user', 'activity', 'reps', 'timestamp', 'url')
  
Add 'id' to both Serializers
## Code Before:
from rest_framework import serializers
from .models import Activity, Datapoint


class ActivitySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Activity
        fields = ('user', 'full_description', 'units', 'url')


class DatapointSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Datapoint
        fields = ('user', 'activity', 'reps', 'timestamp', 'url')

## Instruction:
Add 'id' to both Serializers
## Code After:
from rest_framework import serializers
from .models import Activity, Datapoint


class ActivitySerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Activity
        fields = ('id', 'user', 'full_description', 'units', 'url')


class DatapointSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Datapoint
        fields = ('id', 'user', 'activity', 'reps', 'timestamp', 'url')
