peewee icon indicating copy to clipboard operation
peewee copied to clipboard

Add method/hook for default table names

Open mikemill opened this issue 11 years ago • 2 comments

In our project we are using the singular form for the model names and the plural form for the tables. This means each of our models has to have class Meta: db_table = 'foos'. It'd be nice if there was a method or hook for defining the default table name algorithm that way it can be defined once. Currently it is coded directly into BaseModel.__new__.

mikemill avatar May 10 '15 13:05 mikemill

Nice idea, be happy to add that.

coleifer avatar May 10 '15 15:05 coleifer

Wow, thanks for such a quick response. That solution is awesome!

mikemill avatar May 10 '15 15:05 mikemill