#NEWLINE# def render_layout( self , form , context , template_pack = TEMPLATE_PACK ) : #NEWLINE# #INDENT# '\n        Returns safe html of the rendering of the layout\n        ' #NEWLINE# form . rendered_fields = set ( ) #NEWLINE# form . crispy_field_template = self . field_template #NEWLINE# html = self . layout . render ( form , self . form_style , context , template_pack = template_pack ) #NEWLINE# if ( self . render_unmentioned_fields or self . render_hidden_fields or self . render_required_fields ) : #NEWLINE# #INDENT# fields = set ( form . fields . keys ( ) ) #NEWLINE# left_fields_to_render = ( fields - form . rendered_fields ) #NEWLINE# for field in left_fields_to_render : #NEWLINE# #INDENT# if ( self . render_unmentioned_fields or ( self . render_hidden_fields and form . fields [ field ] . widget . is_hidden ) or ( self . render_required_fields and form . fields [ field ] . widget . is_required ) ) : #NEWLINE# #INDENT# html += render_field ( field , form , self . form_style , context , template_pack = template_pack ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if hasattr ( form , 'Meta' ) : #NEWLINE# #INDENT# if hasattr ( form . Meta , 'fields' ) : #NEWLINE# #INDENT# current_fields = tuple ( getattr ( form , 'fields' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . keys ( ) ) #NEWLINE# meta_fields = getattr ( form . Meta , 'fields' ) #NEWLINE# fields_to_render = list_intersection ( current_fields , meta_fields ) #NEWLINE# left_fields_to_render = list_difference ( fields_to_render , form . rendered_fields ) #NEWLINE# for field in left_fields_to_render : #NEWLINE# #INDENT# html += render_field ( field , form , self . form_style , context ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return mark_safe ( html )