Skip to main content

DRF modifies mixins to return a custom jsonresponse

Project description


  • django restframework 默认是遵循restful api

  • 在中国生产环境中一般不会采用restful规则,返回的结果是通过json_code状态码和message来完成的

  • 该文档修改了原有的mixins,修改返回内容格式

  • list:有分页效果,需要在settings文件中单独设置

    'DEFAULT_PAGINATION_CLASS': 'base.pagination.LargeResultsSetPagination',
    'PAGE_SIZE': 20,
  • create,update,retrieve

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for drf-jsonresponse, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size drf_jsonresponse-0.2.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page