How to pagination the nested-relationships?

Viewed 708

I read the django-rest-framework nested-relationships :

You can see the tracks in AlbumSerializer:

class TrackSerializer(serializers.ModelSerializer):
    class Meta:
        model = Track
        fields = ('order', 'title', 'duration')

class AlbumSerializer(serializers.ModelSerializer):
    tracks = TrackSerializer(many=True, read_only=True)

    class Meta:
        model = Album
        fields = ('album_name', 'artist', 'tracks')

The official website do not give a method to pagination the tracks in AlbumSerializer, if the tracks count is too large, how to realize the pagination for tracks?


EDIT

I want to pagination it by passing a page number to the API.

1 Answers
Related