class NoHTMLFormBrowsableAPIRenderer(BrowsableAPIRenderer):
def get_rendered_html_form(self, *args, **kwargs):
"""
We don't want the HTML forms to be rendered because it can be
really slow with large datasets
"""
return ""
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'nohtml_renderer.NoHTMLFormBrowsableAPIRenderer'
)
}
最后修改:2020 年 08 月 24 日 11 : 49 PM
© 允许规范转载