<s> from django import forms <EOL> from django . contrib . admin . widgets import AdminFileWidget <EOL> from django_options . admin import OptionsPage , admin_pages , option <EOL> from django_options . forms import OptionsForm <EOL> class GeneralsAdminPage ( OptionsPage ) : <EOL> title = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> code = '<STR_LIT>' <EOL> class SiteInfoForm ( OptionsForm ) : <EOL> code = '<STR_LIT>' <EOL> title = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> site_title = option ( forms . CharField ( max_length = <NUM_LIT:255> ) ) <EOL> site_description = option ( forms . CharField ( widget = forms . Textarea ) ) <EOL> class SubGeneralsAdminPage ( OptionsPage ) : <EOL> title = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> code = "<STR_LIT>" <EOL> class SiteSubInfoForm ( OptionsForm ) : <EOL> code = '<STR_LIT>' <EOL> title = '<STR_LIT>' <EOL> site_keywords = option ( forms . CharField ( widget = forms . Textarea ) ) <EOL> site_theme = option ( forms . ChoiceField ( choices = ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ) ) ) <EOL> class SubSubGeneralsAdminPage ( OptionsPage ) : <EOL> title = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> code = "<STR_LIT>" <EOL> class SiteSubInfoForm ( OptionsForm ) : <EOL> code = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> options = ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) <EOL> site_author = option ( forms . CharField ( max_length = <NUM_LIT:100> ) ) <EOL> site_author_email = option ( forms . EmailField ( ) ) <EOL> class ProfileInfoForm ( OptionsForm ) : <EOL> code = '<STR_LIT>' <EOL> title = '<STR_LIT>' <EOL> optionsets = ( ( '<STR_LIT>' , { '<STR_LIT>' : ( '<STR_LIT>' , ( '<STR_LIT:password>' , '<STR_LIT>' , ) , ) } ) , ) <EOL> avatar = option ( forms . FileField ( widget = AdminFileWidget , required = False , initial = True ) ) <EOL> password = option ( forms . CharField ( max_length = <NUM_LIT:255> , widget = forms . PasswordInput , required = False ) ) <EOL> password_confirm = forms . CharField ( max_length = <NUM_LIT:255> , widget = forms . PasswordInput , required = False ) <EOL> def clean ( self ) : <EOL> passphrase = self . cleaned_data . get ( '<STR_LIT:password>' ) <EOL> if passphrase : <EOL> passphrase_confirm = self . cleaned_data . get ( '<STR_LIT>' ) <EOL> if passphrase != passphrase_confirm : <EOL> raise forms . ValidationError ( "<STR_LIT>" ) <EOL> return self . cleaned_data <EOL> class ProfileLoginForm ( OptionsForm ) : <EOL> code = '<STR_LIT>' <EOL> password_check = forms . CharField ( max_length = <NUM_LIT:255> , widget = forms . PasswordInput ) <EOL> def clean_password_check ( self ) : <EOL> from django_options import get_option <EOL> if self . cleaned_data . get ( '<STR_LIT>' ) != get_option ( '<STR_LIT:password>' ) : <EOL> raise forms . ValidationError ( '<STR_LIT>' ) <EOL> return self . cleaned_data . get ( '<STR_LIT>' ) <EOL> form_class_list = [ SiteSubInfoForm , ProfileInfoForm , ProfileLoginForm ] <EOL> class OtherAdminPage ( OptionsPage ) : <EOL> title = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> code = '<STR_LIT>' <EOL> class SiteInfoForm ( OptionsForm ) : <EOL> code = '<STR_LIT>' <EOL> title = '<STR_LIT>' <EOL> my_stuff = option ( forms . CharField ( max_length = <NUM_LIT:255> ) , option_key = '<STR_LIT>' ) <EOL> some_stuff = option ( forms . CharField ( max_length = <NUM_LIT:255> ) ) <EOL> other_stuff = option ( forms . CharField ( widget = forms . Textarea , required = False ) ) <EOL> optionsets = ( <EOL> ( None , { <EOL> '<STR_LIT>' : ( ( '<STR_LIT>' , '<STR_LIT>' , ) , ) <EOL> } ) , <EOL> ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : ( '<STR_LIT>' , ) , <EOL> '<STR_LIT>' : ( '<STR_LIT>' , ) <EOL> } ) , <EOL> ) <EOL> class CustomPage ( OptionsPage ) : <EOL> title = "<STR_LIT>" <EOL> code = "<STR_LIT>" <EOL> template_name = '<STR_LIT>' <EOL> admin_pages . register ( GeneralsAdminPage ) <EOL> admin_pages . register ( OtherAdminPage ) </s>
