예제 #1
0
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')
예제 #2
0
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')
예제 #3
0
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')
예제 #4
0
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')
예제 #5
0
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')
예제 #6
0
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)
예제 #7
0
class CategorySerializer(CategoryBaseSerializer):
    created_by = MyUserSerializer(required=False)

    class Meta(CategoryBaseSerializer.Meta):
        model = Category
        fields = CategoryBaseSerializer.Meta.fields + ('created_by', )
예제 #8
0
class CommentFullSerializer(CommentShortSerializer):
    hotel = HotelShortSerializer(read_only=True)
    user = MyUserSerializer(read_only=True)

    class Meta(HotelShortSerializer.Meta):
        fields = CommentShortSerializer.Meta.fields + ('user', 'hotel')