hi.
I have the following table in a legacy database.
CREATE TABLE `hostgroup_membership` (
`hostid` int(11) NOT NULL default '0',
`groupid` int(11) NOT NULL default '0',
KEY `hostid` (`hostid`),
KEY `groupid` (`groupid`),
CONSTRAINT `hostgroup_membership_ibfk_1` FOREIGN KEY (`hostid`) REFERENCES `host` (`id`) ON DELETE CA
SCADE,
CONSTRAINT `hostgroup_membership_ibfk_2` FOREIGN KEY (`groupid`) REFERENCES `hostgroup` (`id`) ON DEL
ETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Hostgroup membership';
and i would like to use a many2many field in my model to represent this.
right now I have 2 limitations.
1. I can not specify the table name.
2. I can not specify the field names and what they map too.
what I would like to be able to do is somehow specify the tablename, as well as how the fields map to their respective column names.
something like
class Host(meta.model):
Groups = meta.manyTomanyfield(Groups, db_table='foo', columns={self_col:'hostid', to_col:'groupid' })
and have the manytomany code do the right thing.