﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31266	Implement `user.is_member(group)` to easily check whether a user belongs to a group or not	Martin Zugnoni	Martin Zugnoni	"While checking if a user is member of certain group, there's no easy way to check it other than going through the ""groups"" M2M relationship manually, like this.

{{{
#!python
> user.groups.filter(name=""some-group"").exists()
True
}}}

I propose to extend the `django.contrib.auth.models.PermissionsMixin` class, with a `is_member(group)` method, that returns True/False checking whether the user belongs to the group or not. Similar to the `user.has_perm(""some-permission"")`, but for groups.

The same operation using this new method would look like this:

{{{
#!python
> user.is_member(""some-group"")
True
}}}

I'm open to suggestions."	New feature	closed	contrib.auth	dev	Normal	wontfix	auth, groups, users		Unreviewed	0	0	0	0	0	0
