Python全系列 教程
3567个小节阅读:5931.6k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
xxxxxxxxxx
51insert into t_class_type (name,price,all_stage,supervision,`update`,homework,online,work,remote,course_id) values ('线上辅导班',11980,1,1,1,1,1,1,1,1);
2insert into t_class_type (name,price,all_stage,supervision,`update`,homework,online,work,remote,course_id) values ('线上辅导班',11980,1,1,1,1,1,1,1,2);
3insert into t_class_type (name,price,all_stage,supervision,`update`,homework,online,work,remote,course_id) values ('线上辅导班',11980,1,1,1,1,1,1,1,8);
4insert into t_class_type (name,price,all_stage,supervision,`update`,homework,online,work,remote,course_id) values ('线上辅导班',11980,1,1,1,0,0,0,0,6);
5insert into t_class_type (name,price,all_stage,supervision,`update`,homework,online,work,remote,course_id) values ('线上辅导班',18980,1,1,1,1,1,1,1,6);
修改plan_app\serialiazers.py
模块,添加获取轮播图列表序列化器
xxxxxxxxxx
101from rest_framework import serializers
2
3from .models import ClassType
4
5class ClassTypeListSerializer(serializers.ModelSerializer):
6 course_name = serializers.CharField(source='course.name')
7 icon = serializers.CharField(source='course.icon')
8 class Meta:
9 model = ClassType
10 fields = '__all__'
修改plan_app\views.py
模块,添加获取班型列表视图
xxxxxxxxxx
111from rest_framework import generics
2
3from .models import ClassType
4from .serializers import ClassTypeListSerializer
5
6# 根据课程分类ID获取班级类型
7class ClassTypeListView(generics.ListAPIView):
8 queryset = ClassType.objects.all()
9 serializer_class = ClassTypeListSerializer
10
11 filterset_fields = ['course']
修改plan_app\urls.py
模块,添加获取班型列表接口路由
xxxxxxxxxx
81from django.urls import path
2
3from plan_app import views
4
5urlpatterns = [
6 path('plan/',views.PlanDetailView.as_view()),
7 path('class_type/',views.ClassTypeListView.as_view()),
8]