123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- from rest_framework import serializers
- from games.models import Developer, Game, GameSystem, Publisher
- # Serializers define the API representation.
- class GameSerializer(serializers.HyperlinkedModelSerializer):
- class Meta:
- model = Game
- fields = (
- "id",
- "name",
- "publisher",
- "developer",
- "players",
- "rating",
- "game_system",
- )
- class DeveloperSerializer(serializers.HyperlinkedModelSerializer):
- class Meta:
- model = Developer
- fields = (
- "name",
- "slug",
- )
- class PublisherSerializer(serializers.HyperlinkedModelSerializer):
- class Meta:
- model = Publisher
- fields = (
- "name",
- "slug",
- )
- class GameSystemSerializer(serializers.HyperlinkedModelSerializer):
- class Meta:
- model = GameSystem
- fields = (
- "name",
- "retropie_slug",
- "slug",
- )
|