Register a handler or a function to be called after successful code pass.
    If transaction signals are not active the handler/function is called immediately.
    :param handler: handler or function that will be called.
    :param using: name of the database

def on_success(handler, using=None):
    """
    Register a handler or a function to be called after successful code pass.
    If transaction signals are not active the handler/function is called immediately.
    :param handler: handler or function that will be called.
    :param using: name of the database
    """

    connection = get_connection(using)
    if getattr(connection, 'transaction_signals_context_list', False):
        connection.transaction_signals_context_list[-1].register(handler)
    else:
        if settings.DEBUG:
            logger.warning(
                'For on success signal should be activated transaction signals via transaction_signals decorator.'
                'Function is called immediately now.'
            )
        handler()