﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15123	models Meta's db_table  and ManyToManyField	tangc		"Given both models as follows:

{{{
class P(AuditModel):
    description = models.CharField(max_length=50, unique=True)

    class Meta:
        db_table = 'P'

class XSummary(AuditModel):
    p = models.ManyToManyField(P, blank = True, null = True, ) 
    
    class Meta:
        db_table = 'Summary'
}}}

The 2 models with cutomized db_table name will generate a relationship table as follows:

{{{
CREATE TABLE ""SUMMARY_P"" (
    ""ID"" NUMBER(11) NOT NULL PRIMARY KEY,
    ""XSUMMARY_ID"" NUMBER(11) NOT NULL,
    ""P_ID"" NUMBER(11) NOT NULL REFERENCES ""P"" (""ID"") DEFERRABLE INITIALLY DEFERRED,
)
;

}}}

Now you can see that the table name ""SUMMARY_P"" combined the cutomized db_table name of both models. But the field ""XSUMMARY_ID"" still take the mode name -- ""XSUMMARY"", not the db_table ""SUMMARY"". Franckly, I would like to have the field ""XSUMMARY_ID"" as ""field ""SUMMARY_ID"".

Any feedback or fix on the issue ?



"		closed	Database layer (models, ORM)	1.3-alpha		invalid			Unreviewed	0	0	0	0	0	0
