From 2a4921468021fb2ea40c57f7d9ccdf1627638c90 Mon Sep 17 00:00:00 2001 From: Chunlin Zhang Date: Mon, 6 Jan 2020 14:19:59 +0800 Subject: [PATCH 1/3] use latest uliweb-comui and uliweb-comapps, remove dependency of uliweb-ui and uliweb-apps --- demo/.gitignore | 1 + demo/apps/apijson_demo/templates/index.html | 254 +++++++++--------- .../apijson_demo/templates/layout_demo.html | 14 +- demo/apps/settings.ini | 8 +- demo/apps/tables/templates/Tables/layout.html | 14 +- demo/apps/tables/templates/Tables/list.html | 40 +-- 6 files changed, 158 insertions(+), 173 deletions(-) diff --git a/demo/.gitignore b/demo/.gitignore index 6fe9b08..3e915ba 100644 --- a/demo/.gitignore +++ b/demo/.gitignore @@ -9,3 +9,4 @@ _git data database.db sessions +uploads diff --git a/demo/apps/apijson_demo/templates/index.html b/demo/apps/apijson_demo/templates/index.html index 2eb2075..bae3562 100644 --- a/demo/apps/apijson_demo/templates/index.html +++ b/demo/apps/apijson_demo/templates/index.html @@ -1,137 +1,129 @@ {{extend "layout_demo.html"}} -{{block content_header_title}}

uliweb-apijson api examples

{{end content_header_title}} +{{block title}}uliweb-apijson demo: requests{{end title}} -{{block content_main}} -{{use "ui.vue"}} -{{use "ui.iview"}} +{{block content_wrapper}} + +
+ + + + + + + + + + + + + {item.label} + + + + + + + {item.label} + + + + + + + {item.label} + + + + + + + {item.label} + + + + + + + {item.label} + + + + + + +
login user
+ + {{if request.user:}} +
Logout
+ {{else:}} +
Login
+ {{pass}} +
+ +
HTTP POST URL
+ +
+ +
example name
+ +
+ + +
HTTP HEAD URL
+ +
+ +
example name
+ +
+ + +
POST URL
+ +
+ +
example name
+ +
+ + +
PUT URL
+ +
+ +
example name
+ +
+ + +
DELETE URL
+ +
+ +
example name
+ +
+ + +
request data
+ +
Post
+
+ +
response data
+ +
+
+
+
+
+{{end content_wrapper}} - - -
-
- - - - - - - - - - - - - {item.label} - - - - - - - {item.label} - - - - - - - {item.label} - - - - - - - {item.label} - - - - - - - {item.label} - - - - - - -
login user
- - {{if request.user:}} -
Logout
- {{else:}} -
Login
- {{pass}} -
- -
HTTP POST URL
- -
- -
example name
- -
- - -
HTTP HEAD URL
- -
- -
example name
- -
- - -
POST URL
- -
- -
example name
- -
- - -
PUT URL
- -
- -
example name
- -
- - -
DELETE URL
- -
- -
example name
- -
- - -
request data
- -
Post
-
- -
response data
- -
-
-
-
-
+{{block mainapp_vue}} -{{end content_main}} +{{end mainapp_vue}} diff --git a/demo/apps/apijson_demo/templates/layout_demo.html b/demo/apps/apijson_demo/templates/layout_demo.html index 4fde645..150e62b 100644 --- a/demo/apps/apijson_demo/templates/layout_demo.html +++ b/demo/apps/apijson_demo/templates/layout_demo.html @@ -1,11 +1,5 @@ -{{extend "site/layout0.html"}} +{{extend "iview/layout0.html"}} -{{block title}}uliweb-apijson demo{{end title}} - -{{block mainmenu}} -{{<< mainmenu('apijson')}} -{{end mainmenu}} - -{{block sidemenu}}{{end sidemenu}} - -{{block header_custom_menu}}{{end header_custom_menu}} +{{block mainmenu_config}} +{{mainmenu_name,mainmenu_active='MAINMENU','apijson'}} +{{end mainmenu_config}} diff --git a/demo/apps/settings.ini b/demo/apps/settings.ini index 8dd8d62..bd4ea4f 100644 --- a/demo/apps/settings.ini +++ b/demo/apps/settings.ini @@ -14,9 +14,9 @@ INSTALLED_APPS = [ 'uliweb.contrib.i18n', 'uliweb.contrib.flashmessage', 'uliweb.contrib.rbac', - 'uliweb_apps.site', - 'uliweb_apps.login', 'uliweb_comui', + 'uliweb_comapps.auth.login', + 'uliweb_comapps.auth.user_admin', 'uliweb_apijson.apijson', 'apijson_demo', 'tables', @@ -25,8 +25,8 @@ INSTALLED_APPS = [ [MENUS] MAINMENU = { 'subs':[ - {'name': 'apijson', 'link':'/', 'title':u'requests demo'}, - {'name': 'tables', 'link':'/tables', 'title':u'tables'}, + {'name': 'apijson', 'link':'/', 'title':u'apijson requests demo','icon-iview':'ios-apps'}, + {'name': 'tables', 'link':'/tables', 'title':u'apijson tables demo','icon-iview':'md-document'}, ] } diff --git a/demo/apps/tables/templates/Tables/layout.html b/demo/apps/tables/templates/Tables/layout.html index cbe1ebc..f30644b 100644 --- a/demo/apps/tables/templates/Tables/layout.html +++ b/demo/apps/tables/templates/Tables/layout.html @@ -1,11 +1,5 @@ -{{extend "site/layout0.html"}} +{{extend "iview/layout0.html"}} -{{block title}}uliweb-apijson demo{{end title}} - -{{block mainmenu}} -{{<< mainmenu('tables')}} -{{end mainmenu}} - -{{block sidemenu}}{{end sidemenu}} - -{{block header_custom_menu}}{{end header_custom_menu}} +{{block mainmenu_config}} +{{mainmenu_name,mainmenu_active='MAINMENU','tables'}} +{{end mainmenu_config}} diff --git a/demo/apps/tables/templates/Tables/list.html b/demo/apps/tables/templates/Tables/list.html index e2aae5f..b15e49e 100644 --- a/demo/apps/tables/templates/Tables/list.html +++ b/demo/apps/tables/templates/Tables/list.html @@ -1,27 +1,31 @@ {{extend "Tables/layout.html"}} -{{block content_header_title}}

apijson-table examples

{{end content_header_title}} +{{block title}}uliweb-apijson demo: tables{{end title}} -{{block content_main}} -{{use "ui.vue"}} -{{use "ui.iview"}} +{{block content_wrapper}} {{include "vue/inc_apijson_table.html"}} -{{if role!="ADMIN":}} - -{{pass #if}} -
-
- - - - - -
-
+ +
+ {{if role!="ADMIN":}} + + {{pass #if}} +
+
+ + + + + +
+
+
+
+{{end content_wrapper}} +{{block mainapp_vue}} -{{end content_main}} +{{end mainapp_vue}} From 47e3bbd81b641be4c4e116dbea86213e866c84b6 Mon Sep 17 00:00:00 2001 From: Chunlin Zhang Date: Mon, 6 Jan 2020 15:58:42 +0800 Subject: [PATCH 2/3] demo: remove unnecessary dependency in requirements.txt --- demo/requirements.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/demo/requirements.txt b/demo/requirements.txt index 5acffaa..ac4ec9a 100755 --- a/demo/requirements.txt +++ b/demo/requirements.txt @@ -1,10 +1,6 @@ six SQLAlchemy uliweb3 -uliweb-ui -uliweb-layout -uliweb-menu -uliweb-apps -uliweb-comapps uliweb-comui +uliweb-comapps uliweb-apijson From f35e43cb96957eec8c5bb28e63374a9ebd8130cd Mon Sep 17 00:00:00 2001 From: Chunlin Zhang Date: Mon, 6 Jan 2020 15:59:14 +0800 Subject: [PATCH 3/3] test: fix some test --- tests/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test.py b/tests/test.py index 9839cec..3b71f16 100644 --- a/tests/test.py +++ b/tests/test.py @@ -41,8 +41,8 @@ def test_apijson_get(): ... }''' >>> r = handler.post('/apijson/get', data=data, pre_call=pre_call_as("admin"), middlewares=[]) >>> d = json_loads(r.data) - >>> print(d.keys()) - dict_keys(['code', 'msg', 'user']) + >>> print(d) + {'code': 200, 'msg': 'success', 'user': {'username': 'admin', 'nickname': 'Administrator', 'email': 'admin@localhost', 'is_superuser': True, 'last_login': None, 'date_join': '2018-01-01 00:00:00', 'image': '', 'active': False, 'locked': False, 'deleted': False, 'auth_type': 'default', 'timezone': '', 'id': 1}} >>> #query with id >>> data ='''{