<s> from django import forms <EOL> from django . contrib import admin <EOL> from bluechannel . page . models import Highlight , Type , Event , Template , Page <EOL> class HighlightAdmin ( admin . ModelAdmin ) : <EOL> save_on_top = True <EOL> pass <EOL> admin . site . register ( Highlight , HighlightAdmin ) <EOL> class TypeAdmin ( admin . ModelAdmin ) : <EOL> save_on_top = True <EOL> pass <EOL> admin . site . register ( Type , TypeAdmin ) <EOL> class EventAdmin ( admin . ModelAdmin ) : <EOL> prepopulated_fields = { '<STR_LIT>' : ( '<STR_LIT:name>' , ) } <EOL> save_on_top = True <EOL> list_display = ( '<STR_LIT:name>' , '<STR_LIT>' ) <EOL> search_fields = ( '<STR_LIT:name>' , '<STR_LIT:description>' ) <EOL> pass <EOL> admin . site . register ( Event , EventAdmin ) <EOL> class TemplateAdmin ( admin . ModelAdmin ) : <EOL> save_on_top = True <EOL> list_display = ( '<STR_LIT:name>' , '<STR_LIT:description>' ) <EOL> admin . site . register ( Template , TemplateAdmin ) <EOL> class TemplateModelChoiceField ( forms . ModelChoiceField ) : <EOL> """<STR_LIT>""" <EOL> widget = forms . RadioSelect <EOL> class PageAdmin ( admin . ModelAdmin ) : <EOL> prepopulated_fields = { '<STR_LIT>' : ( '<STR_LIT:title>' , ) } <EOL> save_on_top = True <EOL> list_display = ( '<STR_LIT:title>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:status>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> list_filter = ( '<STR_LIT:status>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> search_fields = ( '<STR_LIT:title>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def formfield_for_foreignkey ( self , db_field , request , ** kwargs ) : <EOL> if db_field . name == "<STR_LIT>" : <EOL> kwargs [ '<STR_LIT>' ] = TemplateModelChoiceField <EOL> return db_field . formfield ( ** kwargs ) <EOL> return super ( PageAdmin , self ) . formfield_for_foreignkey ( db_field , request , ** kwargs ) <EOL> admin . site . register ( Page , PageAdmin ) </s>
