In django models, how to make all table names not have the app label?

Posted by Luigi on Stack Overflow See other posts from Stack Overflow or by Luigi
Published on 2010-06-11T00:04:26Z Indexed on 2010/06/11 0:12 UTC
Read the original article Hit count: 303

Filed under:
|
|

I have a database that was already being used by other applications before i began writing a web interface with django for it. The table names follow simple naming standards, so the django model Customer should map to the table "customer" in the db. At the same time I'm adding new tables/models. Since I find it cumbersome to use app_customer every time i have to write a query (django's ORM is definitely not enough for them) in the other applications and I don't want to rename the existing tables, what is the best way to make all models in my django app use tables without applabel_, besides adding a Meta class with db_table= to each model?

Is there any reason why I shouldn't do this? I have only one web app that needs to access this db, everything else doesn't use django models.

© Stack Overflow or respective owner

Related posts about database

Related posts about django