mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Some sample code for internal testing
This commit is contained in:
parent
896b676a66
commit
c222b9c296
0
InvenTree/plugins/integration/__init__.py
Normal file
0
InvenTree/plugins/integration/__init__.py
Normal file
20
InvenTree/plugins/integration/another_sample.py
Normal file
20
InvenTree/plugins/integration/another_sample.py
Normal file
@ -0,0 +1,20 @@
|
||||
from plugins.integration.integration import *
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class NoIntegrationPlugin(IntegrationPlugin):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "NoIntegrationPlugin"
|
||||
|
||||
|
||||
class WrongIntegrationPlugin(UrlsMixin, IntegrationPlugin):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "WrongIntegrationPlugin"
|
58
InvenTree/plugins/integration/sample.py
Normal file
58
InvenTree/plugins/integration/sample.py
Normal file
@ -0,0 +1,58 @@
|
||||
from plugins.integration.integration import *
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class SimpleIntegrationPlugin(SettingsMixin, UrlsMixin, IntegrationPlugin):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "SimpleIntegrationPlugin"
|
||||
|
||||
def view_test(self, request):
|
||||
return HttpResponse(f'Hi there {request.user.username} this works')
|
||||
|
||||
def setup_urls(self):
|
||||
he = [
|
||||
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), name='ho'),
|
||||
]
|
||||
|
||||
SETTINGS = {
|
||||
'PO_FUNCTION_ENABLE': {
|
||||
'name': _('Enable PO'),
|
||||
'description': _('Enable PO functionality in InvenTree interface'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class OtherIntegrationPlugin(UrlsMixin, IntegrationPlugin):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
||||
PLUGIN_NAME = "OtherIntegrationPlugin"
|
||||
|
||||
# @cls_login_required()
|
||||
def view_test(self, request):
|
||||
return HttpResponse(f'Hi there {request.user.username} this works')
|
||||
|
||||
def setup_urls(self):
|
||||
he = [
|
||||
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), name='ho'),
|
||||
]
|
Loading…
Reference in New Issue
Block a user