Re: how to do a three table join with django models

2009-02-05 Thread rc
I figured it out. The model uses a "different" name for the foreign key. In my instance test is results FK to testcase. I changed it to Results.objects.all().select_related('profile','test') and worked. Thanks for your help. On Feb 5, 10:48 am, rc wrote: > That worked

Re: how to do a three table join with django models

2009-02-05 Thread rc
That worked great for the results and profile model, but I couldn't get it to return any data from the testcase model?? My view def get_results(request): results_list = Results.objects.all().select_related ('profile','testcase') return

Re: how to do a three table join with django models

2009-02-05 Thread felix
Results.objects.all().select_related('profile','testcase') that was easy that's A join B,C if it was A join B join C (my example) class Release fk Artist class Artist fk Label class Label Release.objects.all().select_related('artist','artist_label') note selecting the C class

Re: how to do a three table join with django models

2009-02-05 Thread Daniel Roseman
On Feb 5, 3:50 pm, rc wrote: > 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) >        

how to do a three table join with django models

2009-02-05 Thread rc
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