password
查看人数
type
status
date
slug
summary
category
icon
tags
作者
状态
😀
ModelViewSet快速实现接口正删改查的添加

ModelViewSet实现接口通用的增删改查

添加model类

serializers类添加

外键数据展示
  1. 在meta类之前添加需要返回的数据:locust_name = serializers.CharField(source='locust.name')
2.在meta类中添加 depth = 1 参数,可以把关联的外键的所以参数一起返回
notion image

view视图接口添加

添加路由

💡
有关使用上的问题,欢迎您在底部评论区留言,一起交流~
django实现jwt鉴权django uwsgi+nginx生产部署
Loading...