Jump to >

This documentation covers the in-development release of Djblets. You can see the latest stable docs or all previous versions.

djblets.extensions.resources

class ExtensionResource(extension_manager)[source]

Provides information on installed extensions.

model[source]

alias of djblets.extensions.models.RegisteredExtension

get_list(**kwargs)[source]

Returns the list of known extensions.

Each extension in the list has been installed, but may not be enabled.

Returns a dictionary of links coming off this resource.

The resulting links will point to the resources passed in resources, and will also provide special resources for self (which points back to the official location for this resource) and one per HTTP method/operation allowed on this resource.

update(**kwargs)[source]

Updates the state of the extension.

If enabled is true, then the extension will be enabled, if it is not already. If false, it will be disabled.

get_url_patterns()[source]

Returns the Django URL patterns for this object and its children.

This is used to automatically build up the URL hierarchy for all objects. Projects should call this for top-level resources and return them in the urls.py files.

Returns links to the resources provided by the extension.

The result should be a dictionary of link names to a dictionary of information. The information should contain:

  • ‘method’ - The HTTP method

  • ‘href’ - The URL

  • ‘title’ - The title of the link (optional)

  • ‘resource’ - The WebAPIResource instance

  • ‘list-resource’ - True if this links to a list resource (optional)

class ExtensionRootResourceMixin(*args, **kwargs)[source]

Mixin for Root Resources making use of Extension Resources.

As extensions are able to provide their own API resources, this mixin allows a root resource to generate URI templates for non built-in resources.

See also

RootResource

get_extension_resource()[source]

Return the associated extension resource.

Subclasses using this mixin must implement this method.

Returns

The extension resource associated with the root resource.

Return type

djblets.extensions.resources.ExtensionResource