码迷,mamicode.com
首页 > 移动开发 > 详细

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

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

标签:django python

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

标签:django python

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!