Esempio n. 1
0
 def all_related(self, request, channelmetadata_channel_id, *args, **kwargs):
     """
     endpoint for content api method
     get_all_related(channel_id=None, content=None, **kwargs)
     """
     context = {'request': request, 'channel_id': channelmetadata_channel_id}
     data = serializers.ContentMetadataSerializer(
         api.get_all_related(channel_id=channelmetadata_channel_id, content=self.kwargs['content_id']), context=context, many=True
     ).data
     return Response(data)
Esempio n. 2
0
 def children_of_kind(self, request, channelmetadata_channel_id, *args, **kwargs):
     """
     endpoint for content api method
     children_of_kind(channel_id=None, content=None, kind=None, **kwargs)
     """
     context = {'request': request, 'channel_id': channelmetadata_channel_id}
     data = serializers.ContentMetadataSerializer(
         api.children_of_kind(channel_id=channelmetadata_channel_id, content=self.kwargs['content_id'], kind=self.kwargs['kind']), context=context, many=True
     ).data
     return Response(data)
Esempio n. 3
0
 def retrieve(self, request, content_id=None, channelmetadata_channel_id=None):
     context = {'request': request, 'channel_id': channelmetadata_channel_id}
     content = serializers.ContentMetadataSerializer(
         models.ContentMetadata.objects.using(channelmetadata_channel_id).get(content_id=content_id), context=context
     ).data
     return Response(content)
Esempio n. 4
0
 def list(self, request, channelmetadata_channel_id=None):
     context = {'request': request, 'channel_id': channelmetadata_channel_id}
     contents = serializers.ContentMetadataSerializer(
         models.ContentMetadata.objects.using(channelmetadata_channel_id).all(), context=context, many=True
     ).data
     return Response(contents)