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