Buddha's view on sexuality
There are two levels of Teaching, for the common people, and for professional seekers of Nirvana. 

To first, Buddha taught no-nonsense ethics, chastity etc. Sex for procreation, faithful marriage, these kinds of things. Going mostly by his basic principle of "what leads to peace and harmony is good, what creates causes for potential conflict is bad" - applied to the social norms of those days. 

To the second, he taught universal principles operating at cosmic scale. Natural evolution ("dependent origination") emerges as cyclic self-perpetuating tendencies. These self-perpetuating tendencies culminate in arising of sentient experience. Information trapped in these tendencies identifies some elements of this experience as "self". What in reality is a perpetuating part of the tendency (its capacity for continued existence) in sentient experience arises as something subjectively desirable. This includes sexual attraction.

Therefore, breaking through the charm of seemingly pleasant, and correctly attributing its nature to the self-perpetuating tendency for continued existence, is an appropriate component of practice leading to liberation from the trap of subjective experience.