I am trying to select from the join of the two related tables in DJango as shown below. But I am not able get the field name
of the other table.
In SQL
Also if you want a queryset (so not to use values) you can do this:
m=Membership.objects.filter(person__name="x").select_related('person', depth=1)
Sadly I do not know how to only get one field from that table and still get a queryset.
phonenumber
is a field on person
, so you need to pass in person__phonenumber
m=Membership.objects.filter(person__name='x').values('person','person__phonenumber').