Django doc summary (3)

Django Admin

Django entirely automates creation of admin interfaces for models.The admin isn't intended to be used by site visitors.It's for site managers.

Create an admin user

D:\SamProject\django\samsite>python manage.py createsuperuser
Username (leave blank to use 'sam_rui'): sam_rui
Email address: sam_rui@trendmicro.com.cn
Password:
Password (again):
Superuser created successfully.

Then visit the url ' http://127.0.0.1:8000/admin/' and you should see the admin’s login screen.

Make the samapp app viewed in the admin.
Modify the file 'samapp/admin.py'

from django.contrib import admin    
from .models import Question,Choice

# Register your models here.
admin.site.register(Question)
admin.site.register(Choice)

Then you can view the 'Question' and 'Choice' models in admin site and modify them.

Interactive Python shell

To invoke the Python shell, use this command:

D:\SamProject\django\samsite>python manage.py shell

Some more detail infos are omitted.

posted @ 2015-12-10 22:31  sam_rui  阅读(164)  评论(0编辑  收藏  举报