Ejemplo n.º 1
0
    def __filterHistory(self, Model, pk):
        '''Internal class that handles the creation of the History  Serializer based on the object type, and its public hash.

            DEPRECATED: In favor of :class:`history.api.FilteredHistory`
        '''
        serializer = HistorySerializer(many=True,
                                       instance=History.type(Model, pk))

        return Response(serializer.data, status=status.HTTP_201_CREATED)
Ejemplo n.º 2
0
    def get_queryset(self):
        """
            Retrieves the proper object to filter the history by
        """
        kwargs = self.request.parser_context['kwargs']

        mdl = kwargs['model']
        pk = kwargs['pk']

        try:
            ObjModel = apps.get_model(self.type_map[mdl])

            return History.type(ObjModel, pk,
                                related=True).exclude(event=History.ACCESS)

        except KeyError:
            return Response({'error': 'No type of object %s' % mdl})