如何删除 CrudRestController 响应中的 __actions__ 条目?
我对 CrudRestController 进行子类化以实现 REST 接口。它工作正常,但响应字典包含一个 __actions__
条目,其中包含一些我真的不希望在响应中出现的 html 代码。
根据 TableFiller 类的文档字符串,类似这样的内容应该有效:
class ProcessController(CrudRestController):
model = Process
#...
class table_filler_type(TableFiller):
__model__ = Process
__actions__ = False
但页面总是抛出 AttributeError: 'Process' object has no attribute '__actions__'
有什么建议吗?
I'm subclassing the CrudRestController to implement an REST interface. It works fine, but the response dict contains an __actions__
entry which contains some html code that I really don't want in my response.
According to the TableFiller class' docstring something like this should work:
class ProcessController(CrudRestController):
model = Process
#...
class table_filler_type(TableFiller):
__model__ = Process
__actions__ = False
But the page always throws an AttributeError: 'Process' object has no attribute '__actions__'
Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尽管有内联文档,正确的方法似乎是:
Despite the inline docs, the correct way seems to be: