Q: Query Where in Django i want to make query SQL like this in Django
select auth_group.name auth_user.username 
from  auth_group, auth_user, auth_user_groups
where auth_user.id = auth_user_groups.id AND auth_group.id = auth_group.id AND auth_group.name = "Operator";

table:
auth_user -> id, username

auth_group -> id, name

auth_user_groups -> id, user_id, group_id

and i try query in django like this
p = User.objects.all().prefetch_related('groups').get(groups='Operator')

but error ValueError: invalid literal for int() with base 10: 'Operator'
can you help me solve this problem?`

A: Change
get(groups='Operator')

To
get(groups__name='Operator')

You could get several results so you probably should do:
filter(groups__name='Operator')

