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 } }
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}}
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 } }
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}}
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 }, }
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}}
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}}
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}}
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 } }
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 } }
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 } }
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 } }
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 } }
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 } }
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 } }