Create a super user.
python manage.py createsuperuser
python manage.py runserver
now can review the site in browser to see the effect.
To add blog model to the administrator site, edit admin.py of blog, make a look like this:
from django.contrib import admin
# Register your models here.
from .models import Post
#admin.site.register(Post)
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ('title','slug','author','publish','status')
list_filter = ('status', 'created', 'publish', 'author')
search_fields = ('title', 'body')
prepopulated_fields = {'slug': ('title',)}
raw_id_fields = ('author',)
date_hierarchy = 'publish'
ordering = ('status', 'publish')
- each model is import from django.db.models.Models
- attribute => field
- object => record