10๐
โ
So, 15 minutes after asking the question, and I found my own answer.
Using dir(Team)
, I can see another generated attribute named teamplayer_set
(it also exists on Player).
t = Team.objects.get(pk=168)
for x in t.teamplayer_set.all():
if x.captain:
print "%s (Captain)" % (x.player.name)
else:
print x.player.name
Not sure how I would customize that generated related_name, but at least I know I can get to the data from the template without adding additional query results into the context.
๐คiammichael
Source:stackexchange.com