#If you have a many to many relationship and try to pass an id:
class AlbumSerializer(serializers.ModelSerializer):
tracks = serializers.PrimaryKeyRelatedField(queryset=Item.objects.all(), pk_field=serializers.IntegerField)
class Meta:
model = Album
fields = ['album_name', 'artist', 'tracks']