I am newbie to Django and I am struggling to get my arms around DJango and it's data access api (models).
I have these models: class Profile(models.Model): profile_id = models.AutoField(primary_key=True) profile_name = models.CharField(max_length=75) def __unicode__(self): return self.profile_id def __unicode__(self): return self.profile_name class Meta: db_table = 'profile' class Testcase(models.Model): test_id = models.AutoField(primary_key=True) test_name = models.CharField(max_length=300) src = models.ForeignKey(Source, null=True, blank=True) bitrate = models.IntegerField(null=True, blank=True) test_type = models.CharField(max_length=300) output_resolution = models.CharField(max_length=15, blank=True) def __unicode__(self): return self.test_name class Meta: db_table = 'testcase' class Results(models.Model): result_id = models.AutoField(primary_key=True) date = models.DateTimeField() test = models.ForeignKey(Testcase) profile = models.ForeignKey(Profile) status = models.CharField(max_length=30) graph = models.BlobField(null=True, blank=True) y_psnr = models.DecimalField(null=True, max_digits=5, decimal_places=2, blank=True) u_psnr = models.DecimalField(null=True, max_digits=5, decimal_places=2, blank=True) v_psnr = models.DecimalField(null=True, max_digits=5, decimal_places=2, blank=True) yuv_psnr = models.DecimalField(null=True, max_digits=5, decimal_places=2, blank=True) def __unicode__(self): return self.result_id class Meta: db_table = 'results' and I want to be able to display this data: select result_id, date, profile_name, test_name, status, y_psnr, u_psnr, v_psnr, yuv_psnr from profile, testcase, results where profile.profile_id = results.profile_id and testcase.test_id = results.test_id Which is very easy to do with raw sql, but struggling to do it the "django' way. Any ideas? I have also tried to use raw sql, but struggled to get it to work in my views and templates. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---