Generalized Curie-Weiss-Potts model and quadratic pressure in ergodic theory