def has_transition_perm(bound_method, user):
    """
    Returns True if model in state allows to call bound_method and user have rights on it
    """
    if not hasattr(bound_method, '_django_fsm'):
        im_func = getattr(bound_method, 'im_func', getattr(bound_method, '__func__'))
        raise TypeError('%s method is not transition' % im_func.__name__)

    meta = bound_method._django_fsm
    im_self = getattr(bound_method, 'im_self', getattr(bound_method, '__self__'))
    current_state = meta.field.get_state(im_self)

    return (meta.has_transition(current_state) and
            meta.conditions_met(im_self, current_state) and
            meta.has_transition_perm(im_self, current_state, user))
def has_transition_perm ( bound_method , user ) : if not hasattr ( bound_method , '_django_fsm' ) : im_func = getattr ( bound_method , 'im_func' , getattr ( bound_method , '__func__' ) ) raise TypeError ( '%s method is not transition' % im_func . __name__ ) meta = bound_method . _django_fsm im_self = getattr ( bound_method , 'im_self' , getattr ( bound_method , '__self__' ) ) current_state = meta . field . get_state ( im_self ) return ( meta . has_transition ( current_state ) and meta . conditions_met ( im_self , current_state ) and meta . has_transition_perm ( im_self , current_state , user ) )
Returns True if model in state allows to call bound_method and user have rights on it