【发布时间】:2014-11-09 19:47:33
【问题描述】:
我正在使用 django-rest-framwork 和 django-rest-swagger。
问题是我直接从请求正文中获取数据:
def put(self, request, format=None):
"""
This text is the description for this API
username -- username
password -- password
"""
username = request.DATA['username']
password = request.DATA['password']
但是当我尝试来自 swagger-ui 的请求时,我无法指定“参数类型”(默认情况下它是查询,无法从文档字符串中找到更改它的方法)
我已经设法通过从文件 "introspectors.py" 更改函数 build_query_params_from_docstring 中的某些行来解决我的问题,但我想知道是否还有其他方法去做吧。
【问题讨论】:
标签: python django-rest-framework