djblets.webapi.resources.group¶
Built-in resource representing the Group model.
- class GroupResource¶
Bases:
WebAPIResource
A default resource for representing a Django Group model.
- fields: Mapping[str, Union[WebAPIResourceFieldInfo, Mapping[str, Any]]] = ('id', 'name')¶
A mapping of field names to definitions for any serialized objects.
Each key should be a field name either present in
model
or defined as aserialize_<fieldname>_field
method.- Type:
- uri_object_key: Optional[str] = 'group_name'¶
The key to populate with the ID of an object in an item resource.
- Type:
- uri_object_key_regex: str = '[A-Za-z0-9_\\-]+'¶
A regex for mapping keys for an object in an item resource.
By default, this matches integers. Subclasses can override this to match IDs with other values.
- Type:
- model_object_key: str = 'name'¶
The key on the provided model for matching an object key.
This is used when
model
is set, allowing API resources to automatically query for a model instance matching this model key to the value in the URL corresponding touri_object_key
.- Type:
- autogenerate_etags: bool = True¶
Whether to auto-generate ETags for responses.
If set, and an ETag is not otherwise provided, one will be generated based on the response payload.
- Type:
- allowed_methods: Sequence[str] = ('GET',)¶
A list of HTTP methods that are allowed on this resource.
Subclasses must have resource handlers defined for each allowed HTTP method.
- __annotations__ = {'_parent_resource': 'Optional[WebAPIResource]', '_prefetch_related_fields': 'List[str]', '_select_related_fields': 'List[str]', 'allowed_methods': 'Sequence[str]', 'allowed_mimetypes': 'Sequence[AllowedMimetypeEntry]', 'autogenerate_etags': 'bool', 'etag_field': 'Optional[str]', 'fields': 'Mapping[str, Union[WebAPIResourceFieldInfo, Mapping[str, Any]]]', 'is_webapi_handler': 'Final[bool]', 'item_child_resources': 'Sequence[WebAPIResource]', 'last_modified_field': 'Optional[str]', 'list_child_resources': 'Sequence[WebAPIResource]', 'method_mapping': 'Mapping[str, str]', 'mimetype_item_resource_name': 'Optional[str]', 'mimetype_list_resource_name': 'Optional[str]', 'mimetype_vendor': 'Optional[str]', 'model': 'Optional[Type[Model]]', 'model_object_key': 'str', 'model_parent_key': 'Optional[str]', 'paginated_cls': 'Type[WebAPIResponsePaginated]', 'singleton': 'bool', 'uri_object_key': 'Optional[str]', 'uri_object_key_regex': 'str'}¶