python - django user group from request user -


i have assigned user group developer , in admin want query like:

user_group = request.user.groups 

its giving me auth.group.none though have assigned user in group.

why getting none while have assigned user group

as matth pointed out here https://stackoverflow.com/a/2245908/5936450 use following (slightly altered example):

user_group = request.user.groups.values_list('name', flat=true) 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -