首页 > 移动平台 > 详细

【3】依照django官网:创建一个web app

时间:2015-08-17 01:01:39      阅读:211      评论:0      收藏:0      [点我收藏+]

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

版权声明:本文为博主原创文章,未经博主允许不得转载。

【3】依照django官网:创建一个web app

原文:http://blog.csdn.net/wwhrestarting/article/details/47711331

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!