Adam Adam - 4 months ago 28
Python Question

Django Get All Users

I am just starting out with Django and I am messing around just trying to pull a full list of users from postgres.

I used the following code:

group = Group.objects.get(name="Admins")
usersList = group.user_set.all()


How could you pull all users? I don't want to have to pick or assign a group.

group = Group.objects.get() #Doesn't Work.
usersList = group.user_set.all()

Answer
from django.contrib.auth.models import User

users = User.objects.all()