Django学习之Django shell

Django shell交互式,方便调试,开发。

python manage.py shell

from blog.models import Article

a=Article()

a.title='title'

a.brief_content='brief_content'

a.content='content'

a.save()

print (a)

articles=Article.objects.all()

article=articles[0]

print(article.title)

 以上交互式命令可以从数据库存放查找字段。

猜你喜欢

转载自www.cnblogs.com/frantz/p/11487832.html
今日推荐