I have a small Django project with simple models. However, instead of creating my database via
python manage.py syncdb I decided to create it manually and map the tables via
Meta, as shown below
name = models.CharField(max_length=50)
managed = False
db_table = 'ITEM'
but this doesn't work. When I start the development server and run the main view, Django throws an error saying that the relation named
ITEM doesn't exist in the database, when in fact it does exist.
I have done some research but couldn't find anyone with such a problem. Is there a way I can get it working?
Postgres converts table names to lowercase letters unless the queries have quotes around them. See for example:
Normally that detail is abstracted away by the ORM, but if you don't use syncdb, you have to manage it.
The db_table name should be in lowercase:
db_table = 'item'