class SubtaskServSerializer(serializers.ModelSerializer):
    file_list = file_serializers.FileServSerializer(many=True, read_only=True)
    deadline_datetime = string_datetime_field.StringDatetimeField(read_only=True)
    user_responsible_list = user_serializers.UserServMiniSerializer(many=True, read_only=True)
    user_creator = user_serializers.UserServMiniSerializer(read_only=True)

    class Meta:
        model = subtask.Subtask
        fields = ['name', 'description', 'file_list', 'deadline_datetime', 'user_responsible_list', 'status',
                  'create_date', 'user_creator']
class GroupServSerializer(serializers.ModelSerializer):
    image_file = file_serializers.FileServSerializer(read_only=True)
    user_member_list = user_serializers.UserServMiniSerializer(many=True,
                                                               read_only=True)
    user_creator = user_serializers.UserServMiniSerializer(read_only=True)
    invite_link = InviteLinkField(source='invite_id')

    class Meta:
        model = group.Group
        fields = [
            'id', 'name', 'image_file', 'user_member_list', 'create_date',
            'user_creator', 'invite_link'
        ]
예제 #3
0
class UserMapPointServSerializer(serializers.ModelSerializer):
    user = user_serializers.UserServMiniSerializer(read_only=True)
    datetime = string_datetime_field.StringDatetimeField(read_only=True)

    class Meta:
        model = user_map_point.UserMapPoint
        fields = ['user', 'latitude', 'longitude', 'datetime']
class ChatMessageServSerializer(serializers.ModelSerializer):
    file = file_serializers.FileServSerializer(read_only=True)
    user_sender = user_serializers.UserServMiniSerializer(read_only=True)
    send_datetime = string_datetime_field.StringDatetimeField(read_only=True)

    class Meta:
        model = chat_message.ChatMessage
        fields = ['id', 'is_text', 'text', 'file', 'user_sender', 'send_datetime', 'is_read']
class FileServSerializer(serializers.ModelSerializer):
    upload_datetime = string_datetime_field.StringDatetimeField(read_only=True)
    user_uploader = user_serializers.UserServMiniSerializer(read_only=True)
    size = storage_size_field.StorageSizeField(read_only=True)

    class Meta:
        model = file.File
        fields = ['id', 'name', 'extension', 'size', 'upload_datetime', 'user_uploader']
예제 #6
0
class MapPointServSerializer(serializers.ModelSerializer):
    image_file = file_serializers.FileServSerializer(read_only=True)
    event_list = event_serializers.EventServMiniSerializer(many=True,
                                                           read_only=True)
    user_creator = user_serializers.UserServMiniSerializer(read_only=True)

    class Meta:
        model = map_point.MapPoint
        fields = [
            'id', 'name', 'description', 'image_file', 'latitude', 'longitude',
            'event_list', 'create_date', 'user_creator'
        ]
class BudgetItemServSerializer(serializers.ModelSerializer):
    payment_datetime = string_datetime_field.StringDatetimeField(
        read_only=True)
    user_payer = user_serializers.UserServMiniSerializer(read_only=True)
    budget_category_list = budget_category_serializers.BudgetCategoryServSerializer(
        many=True, read_only=True)

    class Meta:
        model = budget_item.BudgetItem
        fields = [
            'id', 'is_income', 'amount', 'name', 'payment_datetime',
            'user_payer', 'budget_category_list'
        ]
class EventServSerializer(serializers.ModelSerializer):
    event_datetime = string_datetime_field.StringDatetimeField()
    file_list = file_serializers.FileServSerializer(many=True, read_only=True)
    map_point = map_point_serializers.MapPointServMiniSerializer(
        read_only=True)
    notify_datetime = string_datetime_field.StringDatetimeField()
    user_creator = user_serializers.UserServMiniSerializer()

    class Meta:
        model = event.Event
        fields = [
            'id', 'event_datetime', 'name', 'description', 'file_list',
            'map_point', 'notify_datetime', 'create_date', 'user_creator'
        ]
예제 #9
0
class ChatServSerializer(serializers.ModelSerializer):
    """
    Need to transmit context 'request_user_id'
    """

    image_file = chat_image_file_field.ChatImageFileField(read_only=True)
    name = chat_name_field.ChatNameField(read_only=True)
    user_member_list = user_serializers.UserServMiniSerializer(read_only=True,
                                                               many=True)
    is_notifying_permitted = chat_is_notifying_permitted_field.ChatIsNotifyingPermittedField(
        read_only=True)
    last_message = chat_last_message_field.ChatLastMessageField(read_only=True)
    number_of_unread = chat_number_of_unread_field.ChatNumberOfUnreadField(
        read_only=True)
    image_file_thumb = chat_image_file_thumb_field.ChatImageFileThumbField(
        read_only=True)

    class Meta:
        model = chat.Chat
        fields = [
            'id', 'image_file', 'name', 'user_member_list',
            'is_notifying_permitted', 'last_message', 'number_of_unread',
            'image_file_thumb', 'is_group_chat'
        ]
 def handle_get(self: base_view.BaseView) -> Optional[base_view.BaseView]:
     self.response_dict[
         'user_member_list'] = user_serializers.UserServMiniSerializer(
             self.dict['group'].user_member_list, many=True).data
     return self