Sign in

Django part 2

1. customize admin

job-> models.py

Let admin page show ID, title, content

@register decorator to register the models (this does exactly the same thing as the admin.site.register() syntax):

2. Modify model

python manage.py makemigrations
python manage.py migrate

backup database:

backup database
add feature into models.py
add default time to create_time in models.py
add ‘create_time’ to list_display in admin.py
add last updated time
add last updated time to admin.py
output
add auther (foreign key) # add foreign key to relate auther to user # on delete-> delete article won’t delete user
add delete function,