学习地址:官网
以下是个人摘录
1.更改开发服务器端口
manage.py runserver 8080
manage.py runserver 10.10.10.10:8000
2.进入shell
manage.py shell
3.数据管理
Poll.objects.all()
Poll.objects.filter(id=1)
Poll.objects.filter(question__startswith=‘What‘)
p = Poll.objects.get(pk=1) #pk=primary key
p.choice_set.all()
p.choice_set.create(choice_text=‘Not much‘, votes=0)
p.choice_set.all()
p.choice_set.count()
原文:http://www.cnblogs.com/linsir/p/4522272.html