There may be a more efficient way, but you can use this for starters: if ( "admin" in request.user.groups.values_list("name",flat=True) ):
On Feb 22, 5:56 pm, Joakim Hove <joakim.h...@gmail.com> wrote: > Hello, > > using the django auth framework I have created two groups called > "admin" and "normal" and all the users are members of either of these > groups. Now when a user is authenticated I would like to render > different views depending on which group the user is member of, > something like this: > > if user_is_member_of_admin_group(): > render_to_response("admin_template.html", context) > elif user_is_member_of_normal_group(): > render_to_response("normal_template.html , context) > else: > hmmm - internal applcation error! > > Any tip on how to write the "user_is_member_of_admin_group()" > function? > > Joakim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.