Django Query Berbagai Kondisi
from django.db.models import Q
criterion1 = Q(UID=request.user.id) #any query you want
criterion2 = Q(FID=user.id) #any query you want
criterion3 = Q(FID=request.user.id) #any query you want
criterion4 = Q(UID=user.id) #any query you want
areTheyFriends = Friends.objects.filter(criterion1 & criterion2 | criterion3 & criterion4) # use `&` and `|` logical operators
Starless