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

StackOverflow https://stackoverflow.com/questions/5369606

  •  27-10-2019
  •  | 
  •  

سؤال

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__', ]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top