Django Models (part 3)

The first, you create a app in your project have name is Blog

$ python startapp blog

Go to file and insert code in INSTALLED_APPS:


and now, you can create model in file (belong to blog app):

from django.db import models
# all model inhert from Model
from django.db.models import Model
# Create your models here.
class PostModel(Model):

and run cmd:

$ python makemigrations # every time you change
$ python migrate

You just create a new file inside of this migrations folder.

ID field will get auto, so you dont need have to create it.

Awesome, if you want learn more, you can see documentations at here:

See you next part ✌️

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.