Example #1
0
class CollectionMetadataSerializer(serializers.ModelSerializer):
    """
    A serializer for a CollectionVersion metadata.
    """

    tags = relations.ManyRelatedField(relations.StringRelatedField())

    class Meta:
        model = models.CollectionVersion
        fields = (
            "authors",
            "contents",
            "dependencies",
            "description",
            "documentation",
            "homepage",
            "issues",
            "license",
            "repository",
            "tags",
        )
Example #2
0
class HandSerializer(serializers.ModelSerializer):
    player = relations.StringRelatedField(many=False)

    class Meta:
        model = Hand
        fields = ('id', 'score', 'player')
Example #3
0
class RoomSerializer(serializers.ModelSerializer):
    members = relations.StringRelatedField(many=True)

    class Meta:
        model = Room
        fields = ('id', 'name', 'members')