# Path: backend/api/serializers/photo.py
# class PhotoSerializer(HyperlinkedModelSerializer):
#     image = MyImageField()
# 
#     class Meta:
#         model = Photo
#         fields = ('name', 'slug', 'image')


from photos.models import Category
from rest_framework.serializers import HyperlinkedModelSerializer
from .photo import PhotoSerializer;


class CategoryListSerializer(HyperlinkedModelSerializer):
    class Meta:
        model = Category
        fields = ('name', 'slug')


class CategoryDetailSerializer(CategoryListSerializer):
    photos = PhotoSerializer(many=True)
    class Meta(CategoryListSerializer.Meta):

# Path: backend/api/serializers/photo.py
# class PhotoSerializer(HyperlinkedModelSerializer):
#     image = MyImageField()
# 
#     class Meta:
#         model = Photo
#         fields = ('name', 'slug', 'image')


# Path: backend/api/serializers/category.py
from photos.models import Category
from rest_framework.serializers import HyperlinkedModelSerializer
from .photo import PhotoSerializer;



class CategoryListSerializer(HyperlinkedModelSerializer):
    class Meta:
        model = Category
        fields = ('name', 'slug')


class CategoryDetailSerializer(CategoryListSerializer):
    photos = PhotoSerializer(many=True)
    class Meta(CategoryListSerializer.Meta):

        fields = ('name', 'slug', 'photos')