django -- 对行的更新只有在save调用后才会入库

python3 manage.py shell
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> django.setup()
>>> from polls.models import Blog,Entry,Author
>>> Blog.objects.all()
<QuerySet []>
>>> b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
>>> b.save()
>>> Blog.objects.all()
<QuerySet [<Blog: Beatles Blog>]>
>>> b.name='New name'
>>> Blog.objects.all()
<QuerySet [<Blog: Beatles Blog>]>
>>> b.save()
>>> Blog.objects.all()
<QuerySet [<Blog: New name>]>

----

原文地址:https://www.cnblogs.com/JiangLe/p/7976310.html