#NEWLINE# def _group_fieldsets( self , fieldsets ) : #NEWLINE# #INDENT# if ( ( not self . declared_fieldsets ) and ( self . group_fieldsets is True ) ) : #NEWLINE# #INDENT# flattened_fieldsets = flatten_fieldsets ( fieldsets ) #NEWLINE# untranslated_fields = [ f . name for f in self . opts . fields if ( ( f is not self . opts . auto_field ) and f . editable and ( not hasattr ( f , 'translated_field' ) ) and ( f . name in flattened_fieldsets ) ) ] #NEWLINE# fieldsets = ( [ ( '' , { #NEWLINE# #INDENT# 'fields' : untranslated_fields , #NEWLINE# #UNINDENT# } ) ] if untranslated_fields else [ ] ) #NEWLINE# temp_fieldsets = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( orig_field , trans_fields ) in self . trans_opts . fields . items ( ) : #NEWLINE# #INDENT# trans_fieldnames = [ f . name for f in sorted ( trans_fields , key = ( lambda x : x . name ) ) ] #NEWLINE# if any ( ( ( f in trans_fieldnames ) for f in flattened_fieldsets ) ) : #NEWLINE# #INDENT# label = self . model . _meta . get_field ( orig_field ) . verbose_name . capitalize ( ) #NEWLINE# temp_fieldsets [ orig_field ] = ( label , { #NEWLINE# #INDENT# 'fields' : trans_fieldnames , #NEWLINE# 'classes' : ( 'mt-fieldset' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# fields_order = unique ( ( f . translated_field . name for f in self . opts . fields if ( hasattr ( f , 'translated_field' ) and ( f . name in flattened_fieldsets ) ) ) ) #NEWLINE# for field_name in fields_order : #NEWLINE# #INDENT# fieldsets . append ( temp_fieldsets . pop ( field_name ) ) #NEWLINE# #UNINDENT# assert ( not temp_fieldsets ) #NEWLINE# #UNINDENT# return fieldsets