The next solution given by @pfctdayelise
For django 1.8 mysql backend
open django/db/backends/mysql/introspection.py and find the get_table_list function:
def get_table_list(self, cursor): cursor.execute("SHOW FULL TABLES") return [TableInfo(row[0], {'BASE TABLE': 't', 'VIEW': 'v'}.get(row[1])) for row in cursor.fetchall()]
Replace it with something like
def get_table_list(self, cursor): names = [TableInfo('mytable1', 't')] return names
To decide if the second argument is TableInfo t or v , run the mysql query SHOW FULL TABLES and find out your table_type , if it's BASE_TABLE , then the second argument is t else v
Then run
python manage.py inspectdb > models.py
source share