<s> """<STR_LIT>""" <EOL> from django import forms <EOL> from django . contrib import admin <EOL> from overseer import conf <EOL> from overseer . models import Service , Event , EventUpdate , Subscription <EOL> class SubscriptionInline ( admin . StackedInline ) : <EOL> model = Subscription . services . through <EOL> extra = <NUM_LIT:1> <EOL> class ServiceAdmin ( admin . ModelAdmin ) : <EOL> list_display = ( '<STR_LIT:name>' , '<STR_LIT:status>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> search_fields = ( '<STR_LIT:name>' , '<STR_LIT:description>' ) <EOL> prepopulated_fields = { '<STR_LIT>' : ( '<STR_LIT:name>' , ) } <EOL> inlines = [ SubscriptionInline ] <EOL> class EventForm ( forms . ModelForm ) : <EOL> if conf . TWITTER_ACCESS_TOKEN and conf . TWITTER_ACCESS_SECRET : <EOL> post_to_twitter = forms . BooleanField ( required = False , label = "<STR_LIT>" , help_text = "<STR_LIT>" ) <EOL> class Meta : <EOL> model = EventUpdate <EOL> class EventUpdateInline ( admin . StackedInline ) : <EOL> model = EventUpdate <EOL> extra = <NUM_LIT:1> <EOL> class EventAdmin ( admin . ModelAdmin ) : <EOL> form = EventForm <EOL> list_display = ( '<STR_LIT>' , '<STR_LIT:description>' , '<STR_LIT:status>' , '<STR_LIT>' ) <EOL> search_fields = ( '<STR_LIT:description>' , '<STR_LIT:message>' ) <EOL> list_filter = ( '<STR_LIT>' , ) <EOL> inlines = [ EventUpdateInline ] <EOL> def save_formset ( self , request , form , formset , change ) : <EOL> instances = formset . save ( ) <EOL> if '<STR_LIT>' in form . cleaned_data and form . cleaned_data [ '<STR_LIT>' ] : <EOL> for obj in instances : <EOL> obj . event . post_to_twitter ( obj . get_message ( ) ) <EOL> class EventUpdateAdmin ( admin . ModelAdmin ) : <EOL> list_display = ( '<STR_LIT>' , '<STR_LIT:message>' , '<STR_LIT:status>' , '<STR_LIT>' ) <EOL> search_fields = ( '<STR_LIT:message>' , ) <EOL> class SubscriptionAdmin ( admin . ModelAdmin ) : <EOL> fields = ( '<STR_LIT:email>' , '<STR_LIT>' , ) <EOL> admin . site . register ( Service , ServiceAdmin ) <EOL> admin . site . register ( Event , EventAdmin ) <EOL> admin . site . register ( EventUpdate , EventUpdateAdmin ) <EOL> admin . site . register ( Subscription , SubscriptionAdmin ) </s>
