Thank you for this conceptual remark. Could the "ForeignKey" filed be a "primary_key at the same time?
datasetID = models.ForeignKey(Dataset, db_column="datasetID", primary_key=True) I suppose I can define a group of fields as "primary_key" by using of the next statement : Class Model(..) datasetID class Meta: ..... unique_together = (("datasetID", "filename", "fileVersion"),) Cheers, Nader On Feb 6, 2:21 pm, Pete Crosier <[EMAIL PROTECTED]> wrote: > A model can only use one field as its primary key and > Distributequeue.objects.get() should only return one object. > > http://www.djangoproject.com/documentation/model-api/#primary-keyhttp://www.djangoproject.com/documentation/db-api/#get-kwargs > > Cheers, Pete. > > On Feb 6, 12:11 pm, Nader <[EMAIL PROTECTED]> wrote: > > > Hallo, > > > I have a model as following: > > > class Distributequeue(models.Model): > > datasetID = models.ForeignKey(Dataset, db_column="datasetID", > > primary_key=True) > > filename = models.CharField(primary_key=True, maxlength=240) > > fileVersion = models.CharField(primary_key=True, maxlength=48) > > distributeModuleID = models.ForeignKey(Distributemodule, > > db_column="distributeModuleID") > > timeOfEntry = models.DateTimeField() > > status = models.CharField(blank=True, maxlength=240) > > timeOfLastStatusUpdate = models.DateTimeField() > > PID = models.IntegerField() > > > def __str__(self): > > return self.filename > > > class Admin: > > list_display = ('fileVersion', 'timeOfEntry', 'status') > > list_per_page = 20 > > search_fields = ('filename', 'status') > > > class Meta: > > db_table = 'distributeQueue' > > unique_together = (("datasetID", "filename", "fileVersion"),) > > > Unfortunately I can't understand the next message which I get from > > "Admin Intreface" for an application. > > > AssertionError at /admin/distributequeues/distributequeue/SCIA_2F6.03/ > > get() returned more than one Distributequeue -- it returned 763! > > Lookup parameters were {'pk': 'SCIA/6.03'} > > > What does it mean? > > > would somebody tell me how I can solve this problem? > > > Regards, > > Nader --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---