It may be the right way, but it's not the best way. Best is to remove the front wheel and enclose the rim within the U-Lock along with the rear wheel. This provides the maximum protection for the more expensive components. It also takes up the maximum space in the U-Lock so it's harder to use a leverage attack on it. Run the cable up through the seat rails and secure it to the U-lock.
Either that, or leave the cable at home and just use the U-Lock for the wheels as described.