1. Design blog model
Article Title - Text Types
Abstract - text types
Article content - text types
--Int tag unique ID number types (increment primary key)
Release date - the date type
2. definition field model layer
Digital Type: IntegerField
Text Type: TestField
Date Type: DateTimeField
Incrementing ID: AutoField
Defines the primary key: primary_key properties
. 1 from django.db Import Models 2 . 3 # the Create your Models here Wallpaper. . 4 . 5 . 6 class Article This article was (models.Model): . 7 # article unique ID . 8 the article_id = models.AutoField (primary_key = True) . 9 # Article Title 10 title = models.TextField () 11 # Abstract 12 brief_content = models.TextField () 13 # contents of the article 14 content = models.TextField () 15 # release date of the article 16 publish_date = models.DateTimeField(auto_now=True)
Create a paper model
Run the migration file, the contents synchronized to the database