5👍
✅
Try:
from django.db import connection as conn
filterd = User.objects.exclude(id = request.user.id).filter(username=data['username'] )
# to execute query
print filterd
print conn.queries
Source:stackexchange.com