Exemplo n.º 1
0
class GearSerializer(serializers.ModelSerializer):
    """
	装備シリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()
    purpose_type_name = serializers.CharField(
        source='get_purpose_type_display', read_only=True)
    riding_type_name = serializers.CharField(source='get_riding_type_display',
                                             read_only=True)

    class Meta:
        model = Gear
        fields = [
            'id', 'user', 'created_at', 'updated_at', 'title', 'purpose_type',
            'purpose_type_name', 'remarks', 'has_rain_wear',
            'has_winter_clothing', 'has_map', 'has_compass', 'has_headlamp',
            'has_mobile_phone', 'has_spare_battery', 'has_first_aid_kit',
            'has_emergency_tent', 'has_transceiver', 'call_sign', 'has_radio',
            'has_tent', 'has_sleeping_bag', 'has_stove', 'has_helmet',
            'has_climbing_rope', 'has_climbing_gear', 'has_crampons',
            'has_ice_axe', 'has_shovel', 'has_beacon', 'has_probe',
            'has_snow_saw', 'has_riding_gear', 'riding_type',
            'riding_type_name'
        ]
        extra_kwargs = {'user': {'read_only': True}}
Exemplo n.º 2
0
class PlanMemberSerializer(serializers.ModelSerializer):
    """
	登山計画メンバーシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()
    prefecture_name = serializers.CharField(source='get_prefecture_display',
                                            read_only=True)
    gender_type_name = serializers.CharField(source='get_gender_type_display',
                                             read_only=True)
    blood_type_name = serializers.CharField(source='get_blood_type_display',
                                            read_only=True)

    class Meta:
        model = PlanMember
        fields = [
            'id', 'created_user', 'created_at', 'updated_user', 'updated_at',
            'plan', 'user', 'name', 'postal_code', 'prefecture',
            'prefecture_name', 'address', 'gender_type', 'gender_type_name',
            'blood_type', 'blood_type_name', 'home_phone_number',
            'cell_phone_number', 'emergency_contact_name',
            'emergency_contact_phone', 'emergency_contact_email',
            'insurance_name', 'insurance_number', 'hitococo_id', 'sort_index'
        ]
        extra_kwargs = {
            'created_user': {
                'read_only': True
            },
            'updated_user': {
                'read_only': True
            }
        }
Exemplo n.º 3
0
class PlanSerializer(serializers.ModelSerializer):
    """
	登山計画シリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()
    purpose_type_name = serializers.CharField(
        source='get_purpose_type_display', read_only=True)
    prefecture_name = serializers.CharField(source='get_prefecture_display',
                                            read_only=True)

    class Meta:
        model = Plan
        fields = [
            'id', 'created_user', 'created_at', 'updated_user', 'updated_at',
            'purpose_type', 'purpose_type_name', 'prefecture',
            'prefecture_name', 'mountain_first', 'mountain_second',
            'mountain_third', 'mountain_fourth', 'mountain_fifth',
            'is_submitted', 'submitted_date', 'entering_date',
            'descending_date', 'affiliate_group_name', 'affiliate_group_phone',
            'has_trail_snacks', 'water_liters', 'food_times',
            'emergency_food_times'
        ]
        extra_kwargs = {
            'created_user': {
                'read_only': True
            },
            'updated_user': {
                'read_only': True
            }
        }
Exemplo n.º 4
0
class PartySerializer(serializers.ModelSerializer):
    """
	パーティシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = Party
        fields = ['id', 'user', 'created_at', 'updated_at', 'name', 'remarks']
        extra_kwargs = {'user': {'read_only': True}}
Exemplo n.º 5
0
class ReadNewsSerializer(serializers.ModelSerializer):
    """
	既読ニュースシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = ReadNews
        fields = ['id', 'user', 'created_at', 'updated_at', 'news']
        extra_kwargs = {
            'user': {
                'read_only': True
            },
        }
Exemplo n.º 6
0
class BookmarkSerializer(serializers.ModelSerializer):
    """
	ブックマークシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = Bookmark
        fields = [
            'id',
            'user',
            'created_at',
            'updated_at',
            'plan',
        ]
        extra_kwargs = {'user': {'read_only': True}}
Exemplo n.º 7
0
class BlockingFriendSerializer(serializers.ModelSerializer):
    """
	ブロックフレンドシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = BlockingFriend
        fields = [
            'id',
            'src_user',
            'dest_user',
            'created_at',
            'updated_at',
        ]
        extra_kwargs = {'src_user': {'read_only': True}}
Exemplo n.º 8
0
class UserTokenSerializer(serializers.ModelSerializer):
    created_at = created_at()
    expiration_at = expiration_at()

    class Meta:
        model = UserToken
        fields = [
            'id', 'user', 'email', 'token', 'created_at', 'expiration_at'
        ]
        extra_kwargs = {
            'user': {
                'read_only': True
            },
            'email': {
                'read_only': True
            },
            'token': {
                'read_only': True
            }
        }
Exemplo n.º 9
0
class UserDetailSerializer(serializers.ModelSerializer):
    """
	ユーザ詳細シリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()
    prefecture_name = serializers.CharField(source='get_prefecture_display',
                                            read_only=True)
    gender_type_name = serializers.CharField(source='get_gender_type_display',
                                             read_only=True)
    blood_type_name = serializers.CharField(source='get_blood_type_display',
                                            read_only=True)

    class Meta:
        model = UserDetail
        fields = [
            'id',
            'user',
            'created_at',
            'updated_at',
            'profile_name',
            'profile_image',
            'name',
            'postal_code',
            'prefecture',
            'prefecture_name',
            'address',
            'gender_type',
            'gender_type_name',
            'blood_type',
            'blood_type_name',
            'home_phone_number',
            'cell_phone_number',
            'emergency_contact_name',
            'emergency_contact_phone',
            'emergency_contact_email',
            'insurance_name',
            'insurance_number',
            'hitococo_id',
        ]
        extra_kwargs = {'user': {'read_only': True}}
Exemplo n.º 10
0
class CustomGearSerializer(serializers.ModelSerializer):
    """
	カスタム装備シリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = CustomGear
        fields = [
            'id', 'user', 'created_at', 'updated_at', 'gear', 'name',
            'sort_index'
        ]
        extra_kwargs = {
            'user': {
                'read_only': True
            },
            'gear': {
                'read_only': True
            }
        }
Exemplo n.º 11
0
class PlanRouteSerializer(serializers.ModelSerializer):
    """
	登山計画ルートシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = PlanRoute
        fields = [
            'id', 'created_user', 'created_at', 'updated_user', 'updated_at',
            'plan', 'plan_date'
        ]
        extra_kwargs = {
            'created_user': {
                'read_only': True
            },
            'updated_user': {
                'read_only': True
            }
        }
Exemplo n.º 12
0
class PlanRouteDetailSerializer(serializers.ModelSerializer):
    """
	登山計画ルート詳細シリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = PlanRouteDetail
        fields = [
            'id', 'created_user', 'created_at', 'updated_user', 'updated_at',
            'plan_route', 'name', 'is_staying', 'sort_index'
        ]
        extra_kwargs = {
            'created_user': {
                'read_only': True
            },
            'updated_user': {
                'read_only': True
            }
        }
Exemplo n.º 13
0
class PartyMemberSerializer(serializers.ModelSerializer):
    """
	パーティメンバーシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = PartyMember
        fields = [
            'id', 'user', 'created_at', 'updated_at', 'party', 'entry_user',
            'sort_index'
        ]
        extra_kwargs = {
            'user': {
                'read_only': True
            },
            'party': {
                'read_only': True
            }
        }
Exemplo n.º 14
0
class FriendSerializer(serializers.ModelSerializer):
    """
	フレンドシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = Friend
        fields = [
            'id', 'src_user', 'dest_user', 'created_at', 'updated_at',
            'friend_request_id'
        ]
        extra_kwargs = {
            'src_user': {
                'read_only': True
            },
            'dest_user': {
                'read_only': True
            }
        }
Exemplo n.º 15
0
class FriendRequestSerializer(serializers.ModelSerializer):
    """
	フレンド申請シリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()
    status_type_name = serializers.CharField(source='get_status_type_display',
                                             read_only=True)

    class Meta:
        model = FriendRequest
        fields = [
            'id', 'src_user', 'dest_email', 'dest_user', 'created_at',
            'updated_at', 'message', 'status_type', 'status_type_name'
        ]
        extra_kwargs = {
            'src_user': {
                'read_only': True
            },
            'dest_user': {
                'read_only': True
            }
        }
Exemplo n.º 16
0
class NewsSerializer(serializers.ModelSerializer):
    """
	ニュースシリアライザ
	"""
    created_at = created_at()
    updated_at = updated_at()

    class Meta:
        model = News
        fields = [
            'id', 'created_at', 'updated_at', 'title', 'content',
            'attached_image'
        ]
        extra_kwargs = {
            'title': {
                'read_only': True
            },
            'content': {
                'read_only': True
            },
            'attached_image': {
                'read_only': True
            }
        }