1 Creating an admin user
$ python manage.py createsuperuser
UserName: wuwh
Password: ganbare
2 Start the development server?
$ python manage.py runserver 8088
visit :http://127.0.0.1:8000/admin/
3 .Make the poll app modifiable in the admin
from django.contrib import admin # Register your models here. from .models import Question,Choice #3.第三版 class ChoiceInline(admin.TabularInline): model = Choice extra = 3 class QuestionAdmin(admin.ModelAdmin): #1.第一版 #fields = [‘pub_date‘,‘question_text‘] #2.第一版 fieldsets=[ (None,{‘fields‘:[‘question_text‘]}), (‘Date information‘,{‘fields‘:[‘pub_date‘],‘classes‘:[‘collapse‘]}), ] inlines = [ChoiceInline] list_display = (‘question_text‘,‘pub_date‘,‘was_published_recently‘) list_filter = [‘pub_date‘] search_fields = [‘question_text‘] admin.site.register(Question,QuestionAdmin)
?$$ python manage.py createsuperuser
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/wwhrestarting/article/details/47711331