开发者

How to get rid of the __actions__ entry in the CrudRestController's response?

开发者 https://www.devze.com 2023-02-18 03:56 出处:网络
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

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?


Despite the inline docs, the correct way seems to be:

class table_filler_type(TableFiller):
    __model__ = Process
    __omit_fields__ = ['__actions__', ]
0

精彩评论

暂无评论...
验证码 换一张
取 消