def to_representation(self, value):
        """
        Calls the developer defined permission methods
        (both global and object) and formats the results into a dictionary.
        """
        results = {}
        for action, method_names in self.action_method_map.items():
            # If using global permissions and the global method exists for this action.
            if not self.object_only and method_names.get('global', None) is not None:
                results[action] = getattr(self.parent.Meta.model, method_names['global'])(self.context['request'])
            # If using object permissions, the global permission did not already evaluate to False and the object
            # method exists for this action.
            if not self.global_only and results.get(action, True) and method_names.get('object', None) is not None:
                results[action] = getattr(value, method_names['object'])(self.context['request'])
        return results
def to_representation ( self , value ) : results = { } for action , method_names in self . action_method_map . items ( ) : if not self . object_only and method_names . get ( 'global' , None ) is not None : results [ action ] = getattr ( self . parent . Meta . model , method_names [ 'global' ] ) ( self . context [ 'request' ] ) if not self . global_only and results . get ( action , True ) and method_names . get ( 'object' , None ) is not None : results [ action ] = getattr ( value , method_names [ 'object' ] ) ( self . context [ 'request' ] ) return results
Calls the developer defined permission methods
        (both global and object) and formats the results into a dictionary.