1
Try to use Q
objects, like so:
from django.db.models import Q
def transactions_log(request):
user = request.user
transactions = Transaction.objects.filter(Q(sender=user) | Q(receiver=user))
return render(request, "transaction.html", {"transactions": transactions})
Source:stackexchange.com