backend/api/serializers.py
2022-06-15 12:05:29 +02:00

47 lines
1.3 KiB
Python
Executable File

from rest_framework import serializers
from photo_log.models import PhotoGroup, Photo, PhotoLog, PhotoTag
class PhotoTagSerializer(serializers.ModelSerializer):
class Meta:
model = PhotoTag
fields = ('id', 'name', 'color')
class PhotoGroupSerializer(serializers.ModelSerializer):
class Meta:
model = PhotoGroup
fields = ('id', 'name', 'date')
class PhotosSerializer(serializers.ModelSerializer):
class Meta:
model = Photo
fields = ('id', 'legacy_id', 'group')
class PhotoSerializer(serializers.ModelSerializer):
tag = PhotoTagSerializer()
class Meta:
model = Photo
fields = ('id', 'legacy_id', 'group', 'bbox_coords', 'rotate', 'intersections', 'original_image', 'cropped_image', 'ocr_text', 'tag')
class PhotoUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Photo
fields = ('id', 'legacy_id', 'group', 'bbox_coords', 'rotate', 'ocr_text', 'tag')
class PhotoLogSerializer(serializers.ModelSerializer):
class Meta:
model = PhotoLog
fields = ('id', 'title', 'date', 'render_date', 'start_slide_image', 'slides', 'pdf')
class PhotoLogsSerializer(serializers.ModelSerializer):
class Meta:
model = PhotoLog
fields = ('id', 'title', 'date', 'pdf')