1👍
Since you want the data of the Process
. It makes more sense to work with:
qs = Process.objects.filter(
sample__isnull=False
).select_related('sample').order_by('endstat')
This will also fetch the related data for the related Sample
, you thus can process this by accessing the fields of the .sample
attribute:
for process in qs:
print(process.sample.name)
Source:stackexchange.com