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>]>

 

 

 

 

 

 

----

 

相关文章:

  • 2021-10-17
  • 2021-11-05
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-01-01
  • 2021-08-25
  • 2021-10-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-01-18
  • 2022-02-26
相关资源
相似解决方案