i have to create lots of tables shared one model.
Model like this:
class MDR_Design(models.Model):
col_file_no=models.CharField(max_length=30,primary_key=True)
col_file_name=models.CharField(max_length=100)
...
then , create table with pymysql connection
....
cur.execute("create table " + projCode + " select * from appname_mdr_design where 1=2")
.....
then ,i have tables: table001,table002,…
in the views:
MDR_Design._meta.db_table=table001
items=MDR_Design.objects.filter(..)....
....
MDR_Design._meta.db_table=table002
items=MDR_Design.objects.filter(..)....
and at this time ,error raised like this:
**(1054, "Unknown column 'table001.col_file_no' in 'field list'")**
how to handle this problem, thank you very very much