Python全系列 教程
3567个小节阅读:5930.2k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
xxxxxxxxxx
51insert into t_rotation_chart (name,img) VALUES ('AIGC人工智能工具全能班','/rotation/banner_new7.jpg');
2insert into t_rotation_chart (name,img) VALUES ('2030百战课程全面升级','/rotation/banner_new1.jpg');
3insert into t_rotation_chart (name,img) VALUES ('VIP专属会员权益','/rotation/banner_new2.jpg');
4insert into t_rotation_chart (name,img) VALUES ('AI人工智能132天学习计划表','/rotation/banner_new4.jpg');
5insert into t_rotation_chart (name,img) VALUES ('大厂算法特训班','/rotation/banner_new3.jpg');
修改homepage_app\serialiazers.py
模块,添加获取轮播图列表序列化器
xxxxxxxxxx
91from rest_framework import serializers
2
3from .models import RotationChart
4
5# 1.创建序列化器类-轮播图
6class RotationChartListSerializer(serializers.ModelSerializer):
7 class Meta:
8 model = RotationChart
9 fields = '__all__'
修改homepage_app\views.py
模块,添加获取轮播图列表视图
xxxxxxxxxx
91from rest_framework import generics
2
3from .models import RotationChart
4from .serializers import RotationChartListSerializer
5
6# 建立获取轮播图列表视图
7class RotationChartListAPIView(generics.ListAPIView):
8 queryset = RotationChart.objects.all().order_by('-id')
9 serializer_class = RotationChartListSerializer
修改homepage_app\urls.py
模块,添加获取轮播图列表视图接口路由
xxxxxxxxxx
71from django.urls import path
2
3from . import views
4
5urlpatterns = [
6 path('rotation_chart/', views.RotationChartListAPIView.as_view()),
7]
配置bz_edu_project\urls.py
基本信息,增加子应用与主应用路由的链接
xxxxxxxxxx
111from django.contrib import admin
2from django.urls import path,include
3
4urlpatterns = [
5 path('admin/', admin.site.urls),
6 path('api/',include('user_app.urls')),
7 path('api/',include('course_app.urls')),
8 path('api/',include('teacher_app.urls')),
9 path('api/',include('free_course_app.urls')),
10 path('api/',include('homepage_app.urls')),
11]