python drf 序列化器之数据的增删改查(详细)
Posted 蚝油生菜
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python drf 序列化器之数据的增删改查(详细)相关的知识,希望对你有一定的参考价值。
#url.py
from django.contrib import admin
from django.urls import path, re_path
from app_drf_books import views
urlpatterns = [
path(\'admin/\', admin.site.urls),
path(\'books/\', views.BooksAPIView.as_view()),
re_path(\'books/(?P<pk>\\d+)\', views.BookAPIView.as_view())
]
#utils.py 自定义工具类
class MyResponse():
def __init__(self):
self.code = 100
self.msg = \'OK\'