3๐
โ
As I understand, You want to list out all slot for the particular customer.
Say example cust_id = 1 then there are slot_id 1,2,3 associated with that customer in appointment table.
I would do something like this,
# Retreive all slot id for the customer with id = 1
slot_ids = Appointment.objects.filter(cust_id=1).values('id')
# Get all slots related to the customer
slots = Slot.objects.filter(id__in=slot_ids)
Remember you should use values() and retrieve specific column for id__in to work with.
Check here for more info https://docs.djangoproject.com/en/2.0/ref/models/querysets/
๐คNagashayan
Source:stackexchange.com