当前位置:网站首页>Djiango第三次培训
Djiango第三次培训
2022-08-03 05:10:00 【曲水流觞683】
1.什么是Django:
Django是一个开放源代码的Web应用框架,由Python写成。采用了MTV的框架模式,即模型M,模板T和视图V。它最初是被开发来用于管理劳伦斯出版集团旗下的一些以新闻内容为主的网站的,即是CMS(内容管理系统)软件。
2.用Django的ORM实现数据的增删查改:
def add_book(request):
books = models.Book.objects.create(title="如来神掌", price=200, publish="功夫出版社", pub_date="2010-10-10")
print(books, type(books))
return HttpResponse("<p>数据添加成功!</p>")
def delect_book(request):
books = models.Book.objects.filter(id=6).delete()
print(books, type(books))
return HttpResponse("<p>数据删除成功!</p>")
def search_book(request):
books = models.Book.objects.filter(id=10).update(title='增删查改')
print(books, type(books))
return HttpResponse("<p>数据查找成功!</p>")
def change_book(request):
books = models.Book.objects.filter(id=3).update(title='change')
print(books, type(books))
return HttpResponse("<p>数据改变成功!</p>")
3.培训教程:
边栏推荐
猜你喜欢
[Harmony OS] [ARK UI] ETS context basic operations
Kotlin-Flow common encapsulation class: the use of StateFlow
tag单调栈-单调栈预备知识-lt.739. 每日温度
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
Jmeter 模拟多用户登录的两种方法
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
Harmony OS ets ArkUI 】 【 】 the development basic page layout and data connection
在树莓派上搭建属于自己的网页(1)
快速上手 Mockito 单元测试框架
Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data
随机推荐
数字孪生园区场景中的坐标知识
[Harmony OS] [ArkUI] ets development graphics and animation drawing
Talking about GIS Data (5) - Geographic Coordinate System
typescript41-class类的私有修饰符
Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
C# async and multithreading
PotPlayer实现上班摸鱼电视自由
Technology Sharing | How to do assertion verification for xml format in interface automation testing?
unity2D横板游戏教程6-敌人AI以及受击动画
高可用 两地三中心
建立树形结构
Presto installation and deployment tutorial
Interface testing framework combat (3) | JSON request and response assertion
阿里云对象存储oss私有桶生成链接
ss-1.curl (cloud-provider-payment8001)
typescript49-交叉类型
Business table analysis - balance system
【Harmony OS】【FAQ】Hongmeng Questions Collection 1
Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data
2022暑假牛客多校联赛第一场