瀏覽代碼

Added the management of url included arguments

Roland Haroutiounian 8 年之前
父節點
當前提交
8fec5bbc42

+ 1
- 0
plugins/webui/interface/controllers/__init__.py 查看文件

@@ -1,2 +1,3 @@
1 1
 from .base import *
2 2
 from .admin import *
3
+from .document import *

+ 2
- 2
plugins/webui/interface/controllers/base.py 查看文件

@@ -6,9 +6,9 @@ from ..template.loader import TemplateLoader
6 6
 # This module contains the web UI controllers that will be called from the web ui class
7 7
 
8 8
 
9
-def get_response(tpl, mimetype='text/html', status_code=200):
9
+def get_response(tpl, tpl_vars={}, mimetype='text/html', status_code=200):
10 10
     loader = TemplateLoader()
11
-    response = Response(loader.render_to_response(tpl), mimetype=mimetype)
11
+    response = Response(loader.render_to_response(tpl, template_vars=tpl_vars), mimetype=mimetype)
12 12
     response.status_code = status_code
13 13
     return response
14 14
 

+ 5
- 0
plugins/webui/interface/template/api/api_lodel_templates.py 查看文件

@@ -1,3 +1,8 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3 3
 # Lodel 2 templates API : loaded by default
4
+
5
+class Test(object):
6
+
7
+    def ok(self):
8
+        return 'ok'

+ 2
- 1
plugins/webui/interface/urls.py 查看文件

@@ -5,5 +5,6 @@ urls = (
5 5
     (r'admin/?$', admin),
6 6
     (r'admin/(.+)$', admin),
7 7
     (r'test/(.+)$', test),
8
-    (r'test/?$', test)
8
+    (r'test/?$', test),
9
+    (r'show/(.+)$', show_document)
9 10
 )

+ 4
- 1
plugins/webui/templates/index/index.html 查看文件

@@ -1,3 +1,6 @@
1 1
 {% extends "base.html" %}
2 2
 {% block title %}Lodel 2 - DASHBOARD{% endblock %}
3
-{% block content %}DASHBOARD{% endblock %}
3
+{% block content %}
4
+    DASHBOARD <br />
5
+    {{ lodel.Test().ok() }}
6
+{% endblock %}

Loading…
取消
儲存