<s> from django . contrib import admin <EOL> from . models import Guide , GuideArticle <EOL> from source . base . widgets import AdminImageMixin <EOL> class GuideArticleInline ( admin . StackedInline ) : <EOL> model = GuideArticle <EOL> extra = <NUM_LIT:1> <EOL> raw_id_fields = ( '<STR_LIT>' , ) <EOL> fieldsets = ( <EOL> ( '<STR_LIT>' , { '<STR_LIT>' : ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) } ) , <EOL> ) <EOL> class GuideAdmin ( AdminImageMixin , admin . ModelAdmin ) : <EOL> save_on_top = True <EOL> prepopulated_fields = { '<STR_LIT>' : ( '<STR_LIT:title>' , ) } <EOL> list_filter = ( '<STR_LIT>' , '<STR_LIT>' , ) <EOL> search_fields = ( '<STR_LIT:title>' , '<STR_LIT>' , '<STR_LIT:description>' , ) <EOL> fieldsets = ( <EOL> ( '<STR_LIT>' , { '<STR_LIT>' : ( ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT:title>' , '<STR_LIT>' ) , '<STR_LIT:description>' , '<STR_LIT>' ) } ) , <EOL> ( '<STR_LIT>' , { '<STR_LIT>' : ( '<STR_LIT>' , '<STR_LIT:image>' ) } ) , <EOL> ) <EOL> inlines = [ GuideArticleInline , ] <EOL> def formfield_for_dbfield ( self , db_field , ** kwargs ) : <EOL> field = super ( GuideAdmin , self ) . formfield_for_dbfield ( db_field , ** kwargs ) <EOL> if db_field . name in [ '<STR_LIT:title>' , '<STR_LIT>' ] : <EOL> field . widget . attrs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if db_field . name == '<STR_LIT>' : <EOL> field . widget . attrs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return field <EOL> admin . site . register ( Guide , GuideAdmin ) </s>
