1👍
✅
That’s because all
method return a ManyRelatedManager
which is basically a list in python. If you want to get the group and not the whole list you may do:
a = request.user.groups.all()[0]
print a
>>> <Group: jefes>
Watch it that this way you access the first element in the list. If the list doesn’t contains any elements this will yield Index out of bounds
exception.
Hope this helps!
Source:stackexchange.com