mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-04-27 21:26:43 +00:00
Add import details
This commit is contained in:
parent
514a24afaf
commit
baa964aade
@ -27,9 +27,42 @@ Custom plugins must inherit from the [InvenTreePlugin class](https://github.com/
|
||||
!!! warning "Namechange"
|
||||
The name of the base class was changed with `0.7.0` from `IntegrationPluginBase` to `InvenTreePlugin`. While the old name is still available till `0.8.0` we strongly suggest upgrading your plugins. Deprecation warnings are raised if the old name is used.
|
||||
|
||||
### Imports
|
||||
|
||||
As the code base is evolving import paths might change. Therefore we provide stable import targets for important python APIs.
|
||||
Please read all release notes and watch out for warnings - we generally provide backports for depreciated interfaces for at least one minor release.
|
||||
|
||||
#### Plugins
|
||||
|
||||
Generall classes an mechanisms are provided under the `plugin` [namespaces](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/__init__.py). These include:
|
||||
|
||||
```python
|
||||
# Management objects
|
||||
registry # Object that manages all plugin states and integrations
|
||||
|
||||
# Base classes
|
||||
InvenTreePlugin # Base class for all plugins
|
||||
|
||||
# Errors
|
||||
MixinImplementationError # Is raised if a mixin is implemented wrong (default not overwritten for example)
|
||||
MixinNotImplementedError # Is raised if a mixin was not implemented (core mechanisms are missing from the plugin)
|
||||
```
|
||||
|
||||
#### Mixins
|
||||
|
||||
Mixins are split up internally to keep the source tree clean and enable better testing seperation. All public APIs that should be used are exposed under `plugin.mixins`. These include all built-in mixins and notification methods. An up-to-date reference can be found in the source code (current master can be [found here](https://github.com/inventree/InvenTree/blob/master/InvenTree/plugin/mixins/__init__.py)).
|
||||
|
||||
#### Models and other internal InvenTree APIs
|
||||
|
||||
!!! warning "Danger Zone"
|
||||
The APIs outside of the `plugin` namespace are not structured for public usage and require a more in-depth knowledge of the Django framework. Please ask in GitHub discussions of the `ÌnvenTree` org if you are not sure you are using something the intended way.
|
||||
|
||||
We do not provide stable interfaces to models or any other internal python APIs. If you need to integrate into these parts please make yourself familiar with the codebase. We follow general Django patterns and only stray from them in limited, special cases.
|
||||
If you need to react to state changes please use the [EventMixin](./plugins/event.md).
|
||||
|
||||
### Plugin Options
|
||||
|
||||
Some metadata options can be defined as constants in the plugins class
|
||||
Some metadata options can be defined as constants in the plugins class.
|
||||
|
||||
``` python
|
||||
NAME = '' # Used as a general reference to the plugin
|
||||
|
Loading…
x
Reference in New Issue
Block a user