Find the union of two Django querysets


Django tip:

You can use | to create a union of multiple queries.

👇

by_username = User.objects.filter(username="John")
by_name = User.objects.filter(full_name="John")
users = by_username | by_name