View full sizeCOLUMBIA/SONY"BAD TEACHER" -- A very dirty, pretty funny comedy about a teacher who's not so much a role model as she is the "before" picture in an ad for a rehab center. Cameron Diaz is unapologetically drunk and foul-mouthed -- and very good -- as the edgy educator, and while the movie could go further it's smart enough not to go longer, and it wraps up before its jokes go stale. R for drug and alcohol use, strong language, sexual situations and violence. 89 min. THREE STARS

You know those films about inspirational teachers, people who make a difference? Films like “Stand and Deliver?” “Lean on Me?” “Dangerous Minds?”

Elizabeth Halsey knows them well.

Because she shows all of them in class, over and over, so she can put her head down on her desk and sneak a nap and maybe recover from her latest hangover.

Yes, Elizabeth is a “Bad Teacher.”

And the film she’s the anti-heroine of is definitely in the defiant tradition of “Bad Santa” – taking supposedly child-friendly figures and turning them into crude, drunken, equal-opportunity offenders.

And getting big laughs while doing it.

It was sort of a 50/50 gamble going in. Director Jake Kasdan did the intermittently funny “The TV Set” and the mostly unfunny “Walk Hard”; the screenwriters have plenty of “The Office” credits but also bear the blame for the unbearable “Year One.”

This one could have gone either way.

That it succeeds is partly due to those filmmakers, too. Kasdan keeps things moving so fast you tend not to mind the gags that don’t work (mostly ones that confuse being rude and raunchy with just being stupid and grade-school gross).

The screenwriters have taken the time to write more than one good character, too; the movie’s called “Bad Teacher,” but Elizabeth is hardly the only not-quite-ready-for-adulthood misfit who stumbles through it, nor the most sympathetic one.

And the fact that there are so many good comic bits here is what’s allowed Kasdan to assemble a great comic cast.

The movie, of course, belongs to Cameron Diaz. She’s always projected a sort of girlfriend-gone-wild sassiness that suggested she’s a hell of a lot of fun after a couple of mango margaritas; “Bad Teacher” is one of the few films that’s allowed her to show that. And not only does she show it, she flaunts it, from a wardrobe that’s tighter than next year’s school budget to a vocabulary that’s definitely not on any standardized test.

But she’s not alone. The wonderful Lucy Punch – the golddigger from “You Will Meet a Tall Dark Stranger” – is a nagging toothache as a too-perfect teacher. Comic actors like Thomas Lennon drop by for brief but marvelous scenes, and Jason Segal is a menschy gym teacher.

Justin Timberlake, however, remains too cool to really commit to his oddball character, a substitute teacher that the man-hungry Diaz fixates on. (That the two performers used to be an item, though, gives an extra level of comic discomfort to their scenes together).

And for a movie that’s supposed to be one long dirty joke, “Bad Teacher” could be even more incorrect — or at least topical. For all her talk, Elizabeth never actually has sex, nor are there many jabs at teacher’s unions or pushy parents — two extremely fertile topics for satire. But the film is fast and often funny. And while it’s not for children — really— I bet the adults who just spent a school year with them are going to love it.