def all_themes(self, request, *args, **kwargs): """ Get all themes list """ data = api_serializers.TrekThemeSerializer(trekking_models.Theme.objects.all(), many=True, context={'request': request}).data return response.Response(data)
def used_themes(self, request, *args, **kwargs): """ Get themes used by Trek instances """ data = api_serializers.TrekThemeSerializer(trekking_models.Theme.objects.filter( pk__in=trekking_models.Trek.objects.existing().values_list('themes', flat=True)), many=True, context={'request': request}).data return response.Response(data)