django--orm---02

Creating a Data

 

Django find the location where the project through the computer cmd command

Execute python manage.py shell

Package name from myapp import models imported to be created

Method One: Create data

Created by models.Account.objects.create

 

 Method Two: Create data

 

o=models.Account(username='wang',password='wang123',email='[email protected]')

o.save()

 

 2 Data Query database created

 

Guess you like

Origin www.cnblogs.com/ljf520hj/p/11725650.html