It depends on the restaurant. Many casual restaurants allow shorts, while more upscale restaurants might have a dress code.