class BusTaskListSerializer(serializers.ModelSerializer): id = serializers.IntegerField(read_only=True) created_by = MyUserSerializer(read_only=True) class Meta: model = BusinessTaskList fields = ('id', 'title', 'created_by', 'image')
class PerTaskListSerializer(serializers.ModelSerializer): id = serializers.IntegerField(read_only=True) created_by = MyUserSerializer(read_only=True) class Meta: model = PersonalTaskList fields = ('id', 'title', 'created_by')
class CategorySerializer(serializers.ModelSerializer): id = serializers.IntegerField(read_only=True) created_by = MyUserSerializer(required=False) created_at = serializers.DateTimeField(required=False) class Meta: model = Category fields = ('id', 'name', 'created_by', 'created_at')
class CategorySerializer(CategoryBaseSerializer): created_by = MyUserSerializer(required=False) product_count = serializers.IntegerField(required=False) class Meta(CategoryBaseSerializer.Meta): model = Category fields = CategoryBaseSerializer.Meta.fields + ('created_by', 'product_count')
class ReservationShortSerializer(serializers.ModelSerializer): room = RoomShortSerializer(read_only=True) guest = MyUserSerializer(read_only=True) # description = serializers.CharField(max_length=300) class Meta: model = Reservation fields = ('id', 'description', 'guest', 'room', 'terminate')
class LikeFullSerializer(serializers.Serializer): hotel = HotelShortSerializer(read_only=True) user = MyUserSerializer(read_only=True) def create(self, validated_data): return Like.objects.create(**validated_data)
class CategorySerializer(CategoryBaseSerializer): created_by = MyUserSerializer(required=False) class Meta(CategoryBaseSerializer.Meta): model = Category fields = CategoryBaseSerializer.Meta.fields + ('created_by', )
class CommentFullSerializer(CommentShortSerializer): hotel = HotelShortSerializer(read_only=True) user = MyUserSerializer(read_only=True) class Meta(HotelShortSerializer.Meta): fields = CommentShortSerializer.Meta.fields + ('user', 'hotel')