Code

Opened 6 years ago

Closed 6 years ago

#6871 closed (invalid)

How to list a user's groups?

Reported by: aaberga@… Owned by: nobody
Component: Documentation Version: 0.96
Severity: Keywords: User Groups
Cc: aaberga@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using Django 0.96 I tried to get the list of a user's groups.

currUser = djModels.User.objects.filter(username -- exact="aaberga")[0]
myGroups = currUser.groups


for aG in myGroups:

theGroup = str(aG)

The loop however fails as the the object in myGroups is not a list. This is however what I understood from the documentation at URL http://www.djangoproject.com/documentation/authentication/.

The line I thought was answering my question is the first under the METHODS heading:

myuser.groups = [group_list]
myuser.groups.add(group, group, ...)

But I seem to have got it wrong...

Thanks and best regards
Aldo

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Trac is not the place to ask for use support, please use either the django-users mailing list of ask in IRC.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.