1125作业 图书管理系统 单表
目录 单表操作 app01文件夹 models.py主要代码 view.py主要代码 urls.py主要代码 template文件夹 index.html主要代码 add.html主要代码 edit.html主要代码 单表操作 提前将数据库连接、app注册、静态文件、模型表等配置修改完成 app01文件夹 models.py主要代码 class Book(models.Model): title = models.CharField(max_length=64) price = models.DecimalField(max_digits=8,decimal_places=2) view.py主要代码 from django.shortcuts import render,HttpResponse,redirect,reverse from app01 import models # Create your views here. def index(request): book_list = models.Book.objects.all() return render(request,'index.html',{'book_list':book_list}) def add(request): if request.method =='POST': title =