coleifer/peewee — pull request #84 by tmoertel (2012-05-21 00:06:42+00:00)
Title: Make common bulk operations on models and tables easier to do and harder to screw up

In this branch, I've made a few small additions to peewee to make some common model and table operations easy, automatic, and hard to screw up:

* finding all your models; and
* creating/dropping their tables.

Instead of having to maintain boilerplate code to do that job, now you can just let peewee take care of it:

models = peewee.discover_models(exclude=[BaseModel])
peewee.create_model_tables(models, fail_silently=True)

That's it. Peewee will automatically gather your models, sort them topologically, and create their tables for you (in the right order).

For a real-world example of the kind of code savings this leads to, see
[how it streamlines peewee's own BaseModelTestCase](https://github.com/tmoertel/peewee/commit/753d599e90e7cb99ce05fc8b904a00bb0b683184#L1R236).

Cheers,
Tom