<s> from django . forms . models import modelformset_factory <EOL> from django . utils . translation import ugettext as _ <EOL> from leonardo . forms import SelfHandlingModelForm <EOL> from leonardo . forms . fields . common import UserField <EOL> from leonardo . module . media . fields . folder import FolderField <EOL> from leonardo . module . media . models import File <EOL> class FileForm ( SelfHandlingModelForm ) : <EOL> folder = FolderField ( required = False ) <EOL> owner = UserField ( required = False ) <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( FileForm , self ) . __init__ ( * args , ** kwargs ) <EOL> if '<STR_LIT>' in self . fields : <EOL> self . fields [ '<STR_LIT>' ] . widget . attrs [ '<STR_LIT>' ] = True <EOL> if '<STR_LIT>' in self . fields : <EOL> self . fields [ '<STR_LIT>' ] . widget . attrs [ '<STR_LIT>' ] = True <EOL> self . init_layout ( ) <EOL> tabs = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT:id>' , <EOL> '<STR_LIT:name>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:file>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> } <EOL> } <EOL> class Meta : <EOL> model = File <EOL> exclude = ( ) <EOL> FileFormset = modelformset_factory ( <EOL> File , form = FileForm , can_delete = True , extra = <NUM_LIT:1> ) </s>
