界面展示:
1 获取所有对象, 上传、修改图片
-
配置路由
-
# 13.brand 管理 router = DefaultRouter() router.register(r'goods/brands', brand_views.BrandViewSet, base_name="brands") urlpatterns += router.urls
-
-
添加视图
-
from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from meiduo_admin.good import brand_serializers from meiduo_admin.my_paginate import MyPageNumberPagination from goods.models import Brand, SKUImage from fdfs_client.client import Fdfs_client from django.conf import settings # 1,获取所有品牌 class BrandViewSet(ModelViewSet)
-