78144666 发表于 2018-8-26 12:19:58

python 3.5 django 笔记(六)Templaters 过滤器 与django shell-rExcHow

D:\django\myblog>python manage.py shell  
#在cmd命令里进入djangoshell
  

  
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AM
  
D64)] on win32
  
Type "help", "copyright", "credits" or "license" for more information.
  
(InteractiveConsole)
  
>>> from blog.models import Article
  
#导入models模块下的Article数据库
  

  
>>> Article.objects.all()
  
#查询所有数据,默认是标题,返回列表
  

  
, , , , , ]>
  
>>> Article.objects.all().values()
  
#返回数据所有值,标题和内容,返回的是字典
  

  



页: [1]
查看完整版本: python 3.5 django 笔记(六)Templaters 过滤器 与django shell-rExcHow