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
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
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
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)
>
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
5 matches
Mail list logo