gpt4 book ai didi

javascript - JS框架能够基于(django)rest api选项生成表单

转载 作者:数据小太阳 更新时间:2023-10-29 04:46:07 27 4
gpt4 key购买 nike

我正在使用 Django REST 框架。
使用可浏览的 API 时,单击 OPTIONS 按钮后,我会看到漂亮的字段定义和允许的资源操作,例如下面的用户资源:

HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS

{
"name": "XSpot User Detail",
"description": "",
"renders": [
"application/json",
"text/html"
],
"parses": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data"
],
"actions": {
"PUT": {
"url": {
"type": "field",
"required": false,
"read_only": true
},
"mail_sent": {
"type": "boolean",
"required": false,
"read_only": false,
"label": "mail sent"
},
"email": {
"type": "email",
"required": true,
"read_only": false,
"label": "email address",
"max_length": 255
}
}
}
}

问题:是否有任何 JS 框架能够利用此元信息生成表单?

最佳答案

嗯,我认为这可能会有所帮助 http://formly-js.github.io/angular-formly这采用 JSON 并呈现 HTML 表单。

关于javascript - JS框架能够基于(django)rest api选项生成表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24893509/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com