I think there is a ticket to add support for compound primary keys... On Jan 15, 2008 3:52 AM, Nader <[EMAIL PROTECTED]> wrote:
> > Hallo, > > I have a "MySQL" table which has more than one field ad a primary key: > > CREATE TABLE `ingestQueue` ( > `datasetID` int(11) NOT NULL, > `filename` varchar(80) NOT NULL default '', > `timeOfRemoteMOD` datetime NOT NULL default '0000-00-00 00:00:00', > `ingestModuleID` int(11) NOT NULL, > `dataSourceID` int(11) NOT NULL, > `timeOfEntry` datetime NOT NULL default '0000-00-00 00:00:00', > `status` varchar(80) default NULL, > `timeOfLastStatusUpdate` datetime NOT NULL default '0000-00-00 > 00:00:00', > `PID` int(11) NOT NULL, > PRIMARY KEY (`datasetID`,`filename`,`timeOfRemoteMOD`) > ) ENGINE=InnoDB DEFAULT CHARSET=latin1; > > > How can define a model in Djano with a primary key which has to have > more than one fields? > > The "python manage.py inspectdb" give the following Django model: > > class Ingestqueue(models.Model): > datasetID = models.IntegerField(primary_key=True) > filename = models.CharField(primary_key=True, maxlength=240) > timeOfRemoteMOD = models.DateTimeField(primary_key=True) > ingestModuleID = models.IntegerField() > dataSourceID = models.IntegerField() > timeOfEntry = models.DateTimeField() > status = models.CharField(blank=True, maxlength=240) > timeOfLastStatusUpdate = models.DateTimeField() > PID = models.IntegerField() > class Meta: > db_table = 'ingestQueue' > > Regards, > Nader > > > -- David Grant http://www.davidgrant.ca --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---