2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-06-12 18:25:27 +00:00

Update plugin docs

- Create separate files for each mixin
- Remove old "report" plugin docs
This commit is contained in:
Oliver
2022-01-13 09:37:09 +11:00
parent 615f84961b
commit 836b5bc741
13 changed files with 179 additions and 27 deletions

View File

@ -0,0 +1,23 @@
---
title: URLs Mixin
---
## UrlsMixin
Use the class constant `URLS` for a array of URLs that should be added to InvenTrees URL paths or override the `plugin.setup_urls` function.
The array has to contain valid URL patterns as defined in the [django documentation](https://docs.djangoproject.com/en/stable/topics/http/urls/).
``` python
class MyUrlsPlugin(URLsMixin, IntegrationPluginBase):
PLUGIN_NAME = "UrlsMixin"
URLS = [
url(r'increase/(?P<location>\d+)/(?P<pk>\d+)/', self.view_increase, name='increase-level'),
]
```
The URLs get exposed under `/plugin/{plugin.slug}/*` and get exposed to the template engine with the prefix `plugin:{plugin.slug}:` (for usage with the [url tag](https://docs.djangoproject.com/en/stable/ref/templates/builtins/#url)).