ORM object relational mapping
table class
a record target
attribute value field corresponding to the object
Will set the id field to the User table's primary key fields in django orm you can not write to the master key dictionary django will default to your table to create a named id primary key field id = models.AutoField (primary_key = True) # Once you specify django primary key field so it will not automatically re-created to help you
First need to write a model class in models.py under application
************************* need to perform database migration (synchronous) command ***************** ************* python3 manage.py makemigrations # only in a small notebook (migrations folder) and modify the database records are not directly manipulate data python3 manage.py the migrate # will modify database records truly synchronized to the database Note: just move the models in the code associated with the database must be re-implementation of the above two commands are indispensable (******)
1. In the terminal input python3 manage.py makemigrations
This data file is automatically created for the migration of records
2. In the terminal input python3 manage.py migrate (the database to be synchronized)