《千锋Django培训》网课笔记(从5到)

五. 

 

 六. 

>>> from myApp.models import Grades, Students
>>> from django.utils import timezone
>>> from datetime import *
>>> Grades.objects.all()
<QuerySet []>
>>> grade1 = Grades()
>>> grade1.gname = "python04"
>>> grade1.gdate = datetime(year=2017,month=7,day=17)
>>> grade1.ggirlnum = 3
>>> grade1.gboynum =70
>>> grade1.save()



>>> from myApp.models import Grades, Students
>>> from django.utils import timezone
>>> from datetime import *
>>> grade2 = Grades()
>>> grade2.gname = "python05"
>>> grade2.gdate = datetime(year=2017,month=7,day=31)
>>> grade2.ggirlnum =1
>>> grade2.gboynum =100
>>> grade2.save()


>>> g = Grades.objects.get(pk=2)
>>> g.gboynum = 99
>>> g.save()
>>> exit()

七.

 

 

 

八.

猜你喜欢

转载自blog.csdn.net/garrulousabyss/article/details/82281951