Skip to main content

Group

Groups are a generic way of categorizing users to apply permissions, or some other label, to those users. A user can belong to any number of groups.

Attributes

AttributeTypeDescription
namestringUnique display name for the group, limited to 150 characters.
permissions[ManyToManyField](../../../db/models/fields/related/manytomanyfield.md?sid=django_db_models_fields_related_manytomanyfield)Collection of permission objects granted to all users belonging to this group.
objects[GroupManager](groupmanager.md?sid=django_contrib_auth_models_groupmanager)The manager instance providing database query operations for Group models.

Constructor

Signature

def Group(
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
*argsanyVariable length argument list passed to the parent Model constructor.
**kwargsanyArbitrary keyword arguments for field values such as 'name' and 'permissions'.

Methods


natural_key()

@classmethod
def natural_key() - > tuple

Returns a tuple containing the group name to uniquely identify the instance during serialization.

Returns

TypeDescription
tupleA single-element tuple containing the group's unique name string.