The actress who played Charlotte in "Sex and the City" will take part in the CBS comedy based on the movie "Bad Teacher," taking on the role played by Lucy Punch in the movie.

Not much has been heard from Kristin Davis since the end of the HBO series that made her famous the world over. But the actress is set to make a TV comeback as Ginny, a highly regarded history teacher who runs the school choir.

Meredith Davis is a new teacher who took the job to find a rich husband and takes no interest in her students, instead drinking and smoking in class. The part played by Cameron Diaz in the movie will be played by Ari Graynor ("Fringe") in the CBS pilot.

"Community" and "Earl" screenwriter Hilary Winston will adapt "Bad Teacher" for TV. Sara Gilbert ("Roseanne," "The Big Bang Theory"), David Alan Grier ("In Living Color") and Ryan Hansen ("Veronica Mars") will also feature in the pilot.