コード例 #1
0
 def list(self, request):
     # We filter out one because it should not be used anymore
     serializer = EnumOutputSerializer([
         choice for choice in VehicleTrailerOption.choices if choice != "1"
     ],
                                       many=True)
     return Response(serializer.data)
コード例 #2
0
 def get_status(self, obj):
     return EnumOutputSerializer(parse_choice_to_tuple(InsuranceStatus(obj.status))).data
コード例 #3
0
 def get_event_size(self, obj):
     return EnumOutputSerializer(parse_choice_to_tuple(EventSize(obj.event_size))).data
コード例 #4
0
 def get_max_coverage(self, obj):
     if not obj.max_coverage:
         return None
     return EnumOutputSerializer(
         parse_choice_to_tuple(TemporaryVehicleInsuranceCoverageOption(obj.max_coverage))
     ).data
コード例 #5
0
 def get_insurance_options(self, obj):
     return EnumOutputSerializer(
         [parse_choice_to_tuple(TemporaryVehicleInsuranceOptionApi(option)) for option in obj.insurance_options],
         many=True,
     ).data
コード例 #6
0
 def get_group_size(self, obj):
     return EnumOutputSerializer(parse_choice_to_tuple(GroupSize(obj.group_size))).data
コード例 #7
0
 def list(self, request):
     serializer = EnumOutputSerializer(
         TemporaryVehicleInsuranceOptionApi.choices, many=True)
     return Response(serializer.data)
コード例 #8
0
 def list(self, request):
     serializer = EnumOutputSerializer(InsuranceStatus.choices, many=True)
     return Response(serializer.data)
コード例 #9
0
 def list(self, request):
     serializer = EnumOutputSerializer(EventSize.choices, many=True)
     return Response(serializer.data)
コード例 #10
0
 def get_trailer(self, obj):
     return EnumOutputSerializer(
         parse_choice_to_tuple(VehicleTrailerOption(obj.trailer))).data
コード例 #11
0
 def get_type(self, obj):
     return EnumOutputSerializer(
         parse_choice_to_tuple(VehicleType(obj.type))).data