mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
refactor of file structure
This commit is contained in:
0
InvenTree/plugins/samples/action/__init__.py
Normal file
0
InvenTree/plugins/samples/action/__init__.py
Normal file
25
InvenTree/plugins/samples/action/simpleactionplugin.py
Normal file
25
InvenTree/plugins/samples/action/simpleactionplugin.py
Normal file
@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""sample implementation for ActionPlugin"""
|
||||
from plugins.action.action import ActionPlugin
|
||||
|
||||
|
||||
class SimpleActionPlugin(ActionPlugin):
|
||||
"""
|
||||
An EXTREMELY simple action plugin which demonstrates
|
||||
the capability of the ActionPlugin class
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "SimpleActionPlugin"
|
||||
ACTION_NAME = "simple"
|
||||
|
||||
def perform_action(self):
|
||||
print("Action plugin in action!")
|
||||
|
||||
def get_info(self):
|
||||
return {
|
||||
"user": self.user.username,
|
||||
"hello": "world",
|
||||
}
|
||||
|
||||
def get_result(self):
|
||||
return True
|
0
InvenTree/plugins/samples/integration/__init__.py
Normal file
0
InvenTree/plugins/samples/integration/__init__.py
Normal file
18
InvenTree/plugins/samples/integration/another_sample.py
Normal file
18
InvenTree/plugins/samples/integration/another_sample.py
Normal file
@ -0,0 +1,18 @@
|
||||
"""sample implementation for IntegrationPlugin"""
|
||||
from plugins.integration import IntegrationPlugin, UrlsMixin
|
||||
|
||||
|
||||
class NoIntegrationPlugin(IntegrationPlugin):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "NoIntegrationPlugin"
|
||||
|
||||
|
||||
class WrongIntegrationPlugin(UrlsMixin, IntegrationPlugin):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "WrongIntegrationPlugin"
|
42
InvenTree/plugins/samples/integration/sample.py
Normal file
42
InvenTree/plugins/samples/integration/sample.py
Normal file
@ -0,0 +1,42 @@
|
||||
"""sample implementations for IntegrationPlugin"""
|
||||
from plugins.integration import SettingsMixin, UrlsMixin, NavigationMixin, IntegrationPlugin
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf.urls import url, include
|
||||
|
||||
|
||||
class SampleIntegrationPlugin(SettingsMixin, UrlsMixin, NavigationMixin, IntegrationPlugin):
|
||||
"""
|
||||
An full integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "SampleIntegrationPlugin"
|
||||
|
||||
def view_test(self, request):
|
||||
"""very basic view"""
|
||||
return HttpResponse(f'Hi there {request.user.username} this works')
|
||||
|
||||
def setup_urls(self):
|
||||
he_urls = [
|
||||
url(r'^he/', self.view_test, name='he'),
|
||||
url(r'^ha/', self.view_test, name='ha'),
|
||||
]
|
||||
|
||||
return [
|
||||
url(r'^hi/', self.view_test, name='hi'),
|
||||
url(r'^ho/', include(he_urls), name='ho'),
|
||||
]
|
||||
|
||||
SETTINGS = {
|
||||
'PO_FUNCTION_ENABLE': {
|
||||
'name': _('Enable PO'),
|
||||
'description': _('Enable PO functionality in InvenTree interface'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
}
|
||||
|
||||
NAVIGATION = [
|
||||
{'name': 'SampleIntegration', 'link': 'plugin:SampleIntegrationPlugin:hi'},
|
||||
]
|
Reference in New Issue
Block a user