django-extdirectrpc is a package to make RPC bridge between ExtJS (throw Ext.Direct) and Django.
- Install extdirectrpc
- Add next lines into urls.py.
from extdirectrpc.views import extdirect_rpc_urls
urlpatterns += extdirect_rpc_urls()
- Add next line into settings.py:
EXT_DIRECT_RPC_MOUNTPOINT = '/router/'
- Add next line into TEMPLATE_CONTEXT_PROCESSORS:
'extdirectrpc.context_processors.global_vars',
- Add next line into template:
<script src="{{ EXT_DIRECT_ROUTER_API_URL }}"></script>
- Create rpc.py in submodule with new lines for testing:
from extdirectrpc.action import ExtDirectRPCAction as RPCAction
class TestAction(RPCAction):
def doEcho(self, data, request):
return data
- Append to template your js filewith next line:
Ext.direct.Manager.addProvider(EXT_DIRECT_RPC_PROVIDER);
- Now function doEcho available by path Remote.TestAction.doEcho