1👍
You can work with:
Messages.objects.filter(sender=15).values_list('receiver', flat=True).union(
Messages.objects.filter(receiver=15).values_list('sender', flat=True)
)
- [Answered ]-Django – how to force user to select a certain amount of options in a checbox modelform?
Source:stackexchange.com