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
| Attribute | Type | Description |
|---|---|---|
| name | string | Unique 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
| Name | Type | Description |
|---|---|---|
| *args | any | Variable length argument list passed to the parent Model constructor. |
| **kwargs | any | Arbitrary 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
| Type | Description |
|---|---|
tuple | A single-element tuple containing the group's unique name string. |