Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions demo/apps/apijson_demo/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ moment = {
"roles" : ["OWNER"]
}
}
comment = {
"user_id_field" : "user_id",
"rbac_get" : {
"roles" : ["OWNER"]
},
"rbac_post" : {
"roles" : ["OWNER"]
}
}

[APIJSON_REQUESTS]
moment = {
Expand All @@ -22,3 +31,11 @@ moment = {
"NECESSARY" : ["content"]
}
}

comment = {
"comment": {
"ADD" :{"@role": ["OWNER"]},
"DISALLOW" : ["id"],
"NECESSARY" : ["content"]
}
}
9 changes: 9 additions & 0 deletions demo/apps/apijson_demo/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
watch: {
request_data : function(n,o){
vm.can_post = true
},
tab_current : function(n,o){
if (n=="tab_get") {
vm.request_data = vm.request_get[0].value
}
else if (n=="tab_post") {
vm.request_data = vm.request_post[0].value
}
vm.response_data = ""
}
}
})
Expand Down
24 changes: 23 additions & 1 deletion demo/apps/apijson_demo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def index():
}''',
},
{
"label":"Array query",
"label":"Array query: user",
"value":'''{
"[]":{
"@count":2,
Expand All @@ -43,6 +43,18 @@ def index():
"@order":"id-"
}
}
}''',
},
{
"label":"Array query: moment",
"value":'''{
"[]":{
"@count":10,
"@page":0,
"moment":{
"@order":"id-"
}
}
}''',
},
]
Expand All @@ -58,6 +70,16 @@ def index():
]
},
"@tag": "moment"
}''',
},
{
"label":"Add new comment",
"value":'''{
"comment": {
"moment_id": 1,
"content": "new test comment"
},
"tag": "comment"
}''',
},
]
Expand Down
2 changes: 1 addition & 1 deletion uliweb_apijson/apijson/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _get_array(self,key):

#model settings
model_setting = settings.APIJSON_MODELS.get(modelname,{})
secret_fields = model_setting["secret_fields"]
secret_fields = model_setting.get("secret_fields")

#model params
#column
Expand Down