class MoreActicl(object): list_display = ['title', 'body', 'auth'] readonly_fields = ['detail'] # 只读字段 exclude = ['auth'] # 不显示某个字段 form_layout = ( Fieldset( u'', Row('title', 'auth'), # Row表示将里面的字段作为一行显示 Row('classify'), css_class='unsort' # 不让区块拖动 ), Fieldset( ('正文内容'), # Fieldset第一个参数表示区块名称 'body', ), Fieldset( ('备注'), Row('detail'), css_class='unsort no_title' # no_title是不显示区块的title名称 ), TabHolder( Tab( 'body-raw', Field('title', css_class="extra"), # css_class="extra"可以将输入框占一整行 Field('body'), css_class='unsort'), Tab('body-json', Field('body', )), css_class='unsort', ))
class ControlActicl(object): list_display = ['title', 'body', 'auth'] # readonly_fields = ['detail'] #设置只读字段 # exclude = ['auth'] # 不显示某个字段 # 传入元组 form_layout = ( Fieldset(('基本信息'), Row('title', 'auth'), # Row表示将里面的字段显示为一行 Row('classify'), css_class='unsort', # 不让区块移动 ), Fieldset(('正文内容'), # Fieldset第一个参数表示区块名称 'body', css_class='unsort', ), Fieldset(('备注'), Row('detail'), css_class='unsort no_title', # no_title是不显示区块的名称 ), TabHolder( Tab('body-row', Field('title', css_class='extra'), Field('body'), css_class='unsort' ), Tab('body-json', Field('body', ), ), css_class='unsort', ) )
class ControlActicl(object): list_display = ['title', 'body', 'auth'] #readonly_fields = ['detail'] # 只读字段 #exclude = ['auth'] # 不显示某个字段 form_layout = [ Fieldset('主要信息', Row('title', 'auth'), Row('classify'), css_class='unsort'), Fieldset( ('正文内容'), # Fieldset第一个参数表示区块名称 'body', css_class='unsort'), Fieldset( ('备注'), Row('detail'), css_class='unsort no_title' # no_title是不显示区块的title名称 ), TabHolder( Tab('body-raw', Field('title', css_class="extra"), Field('body'), css_class='unsort'), Tab('body-json', Field('body', )), css_class='unsort', ) ]
class CourseAdmin(object): list_display = ['name','time','type','level','introduction','studey_num','create_time','update_time','section','teacher'] search_fileds = ['name','time','type','level'] list_filter = ['name','time','type','level'] #dj39 form_layout = ( Fieldset(u'', Row('name','time','type'), Row('level','studey_num','teacher'), #模块不可以拖动 css_class='unsort' ), Fieldset(('描述'), Row('introduction'), ), Fieldset(('章节'), Row('section'), #不显示区块的title名 css_class='unsort no_title' ), #dj41 TabHolder( Tab('标签1', Field('name',css_class="extra"),#输入框可以占一整行 Field('time'), css_class='unsort'), Tab('标签2', Field('type','level'), Field('teacher'), ) ), )
def get_form_layout(self): self.form_layout = ( Main( 'category', Field('title', css_class="extra"), 'content', ), ) return super(ArticleAdmin, self).get_form_layout()
class ArticleAdmin(object): list_display = ('title', 'categories', 'date') list_display_links = ('title', ) search_fields = ('title', 'content') list_editable = ('date', ) list_filter = ('categories', 'date') form_layout = ( Fieldset('基本信息', 'title', 'date'), Fieldset('文章内容', Field('content', template="xcms/content_field.html")), ) style_fields = {'content': 'wysi_ck', 'categories': 'm2m_tree'}