Dress codes are created with staff and parent councils. Just because overeager parents are being strange enforcers, doesn't mean there is something wrong with it.
I had a student who insisted on wearing yoga/dance pants to school, with the waist band folded down. She would seductively raise her arms, stretch, and let everyone see her belly. The boys didn't know where to look. Nor did I. This was in grade six.