コード例 #1
0
 def all_types(self, request, *args, **kwargs):
     """
     Get all POI types
     """
     data = api_serializers.POITypeSerializer(trekking_models.POIType.objects.all(),
                                              many=True,
                                              context={'request': request}).data
     return response.Response(data)
コード例 #2
0
 def used_types(self, request, *args, **kwargs):
     """
     Get POI types used by POI instances
     """
     data = api_serializers.POITypeSerializer(
         trekking_models.POIType.objects.filter(pk__in=trekking_models.POI.objects.existing()
                                                .values_list('type_id', flat=True)),
         many=True,
         context={'request': request}).data
     return response.Response(data)