当前位置:网站首页>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.培训教程:
边栏推荐
- JS底层手写
- typescript39-class类的可见修饰符
- Interface Test Framework Practice | Process Encapsulation and Test Case Design Based on Encrypted Interface
- Coordinate knowledge in digital twin campus scenarios
- 1094 谷歌的招聘 (20 分)
- Redis6学习笔记
- 在线密码生成工具推荐
- Ali cloud object storage oss private barrels to generate links
- MySql数据库
- [Harmony OS] [ARK UI] ETS context basic operations
猜你喜欢
typescript39-class类的可见修饰符
【Biotin Azide|cas:908007-17-0】Price_Manufacturer
Online password generator tool recommendation
JS学习笔记(三)
idea使用@Autowired注解爆红原因及解决方法
接口测试实战| GET/POST 请求区别详解
BIOTIN ALKYNE CAS: 773888-45-2 Price, Supplier
Js学习笔记(四)
tag单调栈-单调栈预备知识-lt.739. 每日温度
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
随机推荐
接口测试如何准备测试数据
Online password generator tool recommendation
Response 重写设置返回值
用户密码验证
Super handy drawing tool is recommended
接口测试实战| GET/POST 请求区别详解
Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data
Redis6学习笔记
MCM box model modeling method and source analysis of atmospheric O3
CAD有生僻字如何打出来、如何提交软件相关问题或建议?
idea使用@Autowired注解爆红原因及解决方法
Create a tree structure
Talking about GIS Data (5) - Geographic Coordinate System
BIOTIN ALKYNE CAS: 773888-45-2 Price, Supplier
Tag stack - stack monotonically preparatory knowledge - lt. 739. The daily temperature
High availability, two locations and three centers
测试人员的价值体现在哪里
2022/08/02 学习笔记 (day22) 多线程
Secondary development of WinForm controls
初步认识ZK