def _crispy_helper(instance): """ Create the crispy-forms FormHelper. The form will then be rendered using {% crispy form %} in the template. :param UserAS instance: """ helper = FormHelper() helper.attrs['id'] = 'id_user_as_form' helper.layout = Layout( AppendedText('label', '<span class="fa fa-pencil"/>'), Field( 'installation_type', template='scionlab/partials/installation_type_accordion.html', ), ) # We need this to render the UserASForm along with the AttachmentConfForm helper.form_tag = False helper.disable_csrf = True # Inject some helpers into the context (crispy does the magic): helper.accordion_templates = ["scionlab/partials/installation_type_vm.html", "scionlab/partials/installation_type_pkg.html", "scionlab/partials/installation_type_src.html"] if instance and instance.pk: host = instance.hosts.get() helper.host_id = host.uid helper.host_secret = host.secret return helper
def helper(self): helper = FormHelper() helper.form_tag = False helper.disable_csrf = True helper.form_method = 'POST' helper.layout = Layout( Div( Field('first_name', css_class='input-lg', wrapper_class='col-md-12'), Field('last_name', css_class='input-lg', wrapper_class='col-md-12'), Field('phone_number', css_class='input-lg', wrapper_class='col-md-12'), Field('address', css_class='input-lg', wrapper_class='col-md-12'), Field('citta', css_class='input-lg', wrapper_class='col-md-4'), Field('provincia', css_class='input-lg', wrapper_class='col-md-4'), Field('postal_code', css_class='input-lg', wrapper_class='col-md-4'), css_class='row' ), Div( Field('terms', css_class='', wrapper_class='col-xs-6'), HTML( '<div class="col-xs-6"> <a onclick="window.open(\'%s\',\'terms\',\'resizable,width=200\'); return false" href=""> Leggi le nostre condizioni </a> </div>' % self.terms_url), css_class='row' ), ) return helper
def get_crispy_helper(self, foreign_keys_map=None, crosstab_model=None, **kwargs): from crispy_forms.helper import FormHelper from crispy_forms.layout import Column, Layout, Div, Row, Field helper = FormHelper() helper.form_class = 'form-horizontal' helper.label_class = 'col-sm-2 col-md-2 col-lg-2' helper.field_class = 'col-sm-10 col-md-10 col-lg-10' helper.form_tag = False helper.disable_csrf = True helper.render_unmentioned_fields = True foreign_keys_map = foreign_keys_map or self.foreign_keys helper.layout = Layout( Row(Column(Field('start_date'), css_class='col-sm-6'), Column(Field('end_date'), css_class='col-sm-6'), css_class='raReportDateRange'), Div(css_class="mt-20", style='margin-top:20px')) # first add the crosstab model and its display reimder then the rest of the fields if self.crosstab_model: helper.layout.fields[1].append(Field(self.crosstab_key_name)) if self.crosstab_display_compute_reminder: helper.layout.fields[1].append( Field('crosstab_compute_reminder')) for k in foreign_keys_map: if k != self.crosstab_key_name: helper.layout.fields[1].append(Field(k)) return helper
def test_disable_csrf(self): form = TestForm() helper = FormHelper() helper.disable_csrf = True html = render_crispy_form(form, helper, {'csrf_token': _get_new_csrf_key()}) self.assertFalse('csrf' in html)
def test_disable_csrf(): form = SampleForm() helper = FormHelper() helper.disable_csrf = True html = render_crispy_form(form, helper, {"csrf_token": _get_new_csrf_string()}) assert "csrf" not in html
def get_crispy_helper(self, foreign_keys_map=None, crosstab_model=None, **kwargs): from crispy_forms.helper import FormHelper from crispy_forms.layout import Column, Layout, Div, Row, Field helper = FormHelper() helper.form_class = 'form-horizontal' helper.label_class = 'col-sm-2 col-md-2 col-lg-2' helper.field_class = 'col-sm-10 col-md-10 col-lg-10' helper.form_tag = False helper.disable_csrf = True foreign_keys_map = foreign_keys_map or self.foreign_keys helper.layout = Layout( Row(Column(Field('start_date'), css_class='col-sm-6'), Column(Field('end_date'), css_class='col-sm-6'), css_class='raReportDateRange'), Div(css_class="mt-20", style='margin-top:20px')) # if crosstab_model: # entry_point.append(Row( # Div('matrix_entities', css_class='col-sm-9'), # Div('matrix_show_other', css_class='col-sm-3') # , css_class='matrixField') # ) for k in foreign_keys_map: if k[:-3] != crosstab_model: helper.layout.fields[1].append(Field(k)) return helper
def test_disable_csrf(): form = SampleForm() helper = FormHelper() helper.disable_csrf = True html = render_crispy_form(form, helper, {'csrf_token': _get_new_csrf_key()}) assert 'csrf' not in html
def get_formset_helper(self): helper = FormHelper() helper.form_tag = False helper.disable_csrf = True helper.use_custom_control = False helper.template = "bootstrap4/table_inline_formset.html" return helper
def helper(self): helper = FormHelper() helper.form_id = 'Submit_research' helper.form_class = 'submit' helper.add_input(Submit('submit', 'Cerca')) helper.disable_csrf = True return helper
def helper(self): helper = FormHelper() helper.form_tag = False helper.disable_csrf = True helper.include_media = False helper.form_class = 'form-horizontal' helper.label_class = 'col-4' helper.field_class = 'col-8' return helper
def get_search_form(self): f = forms.SearchForm(self.request.GET) helper = FormHelper() helper.layout = Layout( FieldWithButtons('q', Submit('submit', '搜索', css_class='button'))) helper.form_show_labels = False helper.form_tag = False helper.disable_csrf = True f.helper = helper return f
def __init__(self, *args, **kwargs): super(SubDomainForm, self).__init__(*args, **kwargs) helper = FormHelper() helper.form_class = 'form-horizontal' helper.label_class = 'col-lg-2' helper.field_class = 'col-lg-6' helper.form_tag = False helper.disable_csrf = True self.helper = helper
def bootstrap3(request): helper = FormHelper() helper.form_class = 'form-horizontal' helper.label_class = 'col-lg-4' helper.field_class = 'col-lg-8' helper.disable_csrf = True helper.form_tag = False helper.html5_required = True return { 'crispy_horizontal': helper }
def helper(self): helper = FormHelper() helper.form_tag = False helper.disable_csrf = True helper.include_media = False helper.form_class = 'form-horizontal' helper.label_class = 'col-4' helper.field_class = 'col-8' helper.layout = Layout( Div('ufr', css_id='div_ufr'), Div('dpt', css_id='div_dpt'), Div('niveau', css_id='div_niveau'), Div('formation', css_id='div_formation')) return helper
def __init__(self, *args, **kwargs): wrapper_class = kwargs.pop("wrapper_class", "") super().__init__(*args, **kwargs) helper = FormHelper() helper.layout = Layout( Div( Field( "categories", template="crispy/category-buttons.html", wrapper_class=wrapper_class, ), ), ) helper.form_class = "form-inline" helper.disable_csrf = True helper.form_show_labels = False self.helper = helper
def helper(self): helper = FormHelper() helper.include_media = False helper.form_tag = False helper.disable_csrf = True helper.label_class = 'col-3' helper.field_class = 'offset-4 col-5' helper.layout = Layout( Div('photoId'), Div('carteId_recto'), Div('carteId_verso'), Div('passport'), Div('curriculum_file'), Div('diplome_bac'), Div('attestation_licence'), Div('attestation_master'), ) return helper
def create_forms(protocol, tunnel=None, endpoint1=None, endpoint2=None, data=None): if protocol == 'fastd': tunnel_form_type = FastdTunnelForm endpoint_form_type = FastdTunnelEndpointForm elif protocol == 'vtun': tunnel_form_type = VtunTunnelForm endpoint_form_type = VtunTunnelEndpointForm elif protocol == 'wireguard': tunnel_form_type = WireGuardTunnelForm endpoint_form_type = WireGuardTunnelEndpointForm elif protocol == 'other': tunnel_form_type = TunnelForm endpoint_form_type = TunnelEndpointForm else: raise Http404 tunnel_form = tunnel_form_type(instance=tunnel, data=data, prefix='tunnel') tunnel_form.helper = FormHelper() tunnel_form.helper.form_tag = False tunnel_form.helper.label_class = 'col-xs-4 col-lg-2' tunnel_form.helper.field_class = 'col-xs-8 col-lg-5 col-xl-4' tunnel_form.helper.html5_required = True helper = FormHelper() helper.form_tag = False helper.disable_csrf = True helper.label_class = 'col-xs-4' helper.field_class = 'col-xs-8' helper.html5_required = True endpoint1_form = endpoint_form_type(instance=endpoint1, data=data, prefix='endpoint1') endpoint2_form = endpoint_form_type(instance=endpoint2, data=data, prefix='endpoint2') endpoint1_form.helper = helper endpoint2_form.helper = helper return tunnel_form, endpoint1_form, endpoint2_form
def get_crispy_helper(self, foreign_keys_map=None, crosstab_model=None, **kwargs): helper = FormHelper() helper.form_class = 'form-horizontal' helper.label_class = 'col-sm-2 col-md-2 col-lg-2' helper.field_class = 'col-sm-10 col-md-10 col-lg-10' helper.form_tag = False helper.disable_csrf = True foreign_keys_map = foreign_keys_map or self.foreign_keys from crispy_forms.layout import Layout, Div, Row, Field # from crispy_forms.bootstrap import helper.layout = Layout( # PanelContainer( # # Div( # _('filters'), Row( # Div(StackedField('doc_date'), css_class='col-sm-3'), # InlineField('start_date', css_class='form-control dateinput'), css_class='col-sm-6'), # Div(InlineField('end_date', css_class='form-control dateinput'), css_class='col-sm-6'), Column( Field('start_date'), css_class='col-sm-6'), Column( Field('end_date'), css_class='col-sm-6'), css_class='raReportDateRange'), Div(css_class="mt-20", style='margin-top:20px') ) # if crosstab_model: # entry_point.append(Row( # Div('matrix_entities', css_class='col-sm-9'), # Div('matrix_show_other', css_class='col-sm-3') # , css_class='matrixField') # ) for k in foreign_keys_map: if k[:-3] != crosstab_model: helper.layout.fields[1].append(Field(k)) return helper
def create_forms(protocol, tunnel=None, endpoint1=None, endpoint2=None, data=None): if protocol == 'fastd': tunnel_form_type = FastdTunnelForm endpoint_form_type = FastdTunnelEndpointForm elif protocol == 'vtun': tunnel_form_type = VtunTunnelForm endpoint_form_type = VtunTunnelEndpointForm elif protocol == 'wireguard': tunnel_form_type = WireGuardTunnelForm endpoint_form_type = WireGuardTunnelEndpointForm elif protocol == 'other': tunnel_form_type = TunnelForm endpoint_form_type = TunnelEndpointForm else: raise Http404 tunnel_form = tunnel_form_type(instance=tunnel, data=data, prefix='tunnel') tunnel_form.helper = FormHelper() tunnel_form.helper.form_tag = False tunnel_form.helper.label_class = 'col-xs-4 col-lg-2' tunnel_form.helper.field_class = 'col-xs-8 col-lg-5 col-xl-4' tunnel_form.helper.html5_required = True helper = FormHelper() helper.form_tag = False helper.disable_csrf = True helper.label_class = 'col-xs-4' helper.field_class = 'col-xs-8' helper.html5_required = True endpoint1_form = endpoint_form_type(instance=endpoint1, data=data, prefix='endpoint1') endpoint2_form = endpoint_form_type(instance=endpoint2, data=data, prefix='endpoint2') endpoint1_form.helper = helper endpoint2_form.helper = helper return tunnel_form, endpoint1_form, endpoint2_form
def get_context_data(self, **kwargs): context = super(FilterMixin, self).get_context_data(**kwargs) # Crispy helper to control how filter form is rendered helper = FormHelper() helper.form_tag = False helper.disable_csrf = True # attach helper to form instance self.object_filter.form.helper = helper # add filter object to context filter_name = self.get_filter_name() context[filter_name] = self.object_filter # add the querystring used to filter to the context data removing `page` # param so that we can easily integrate pagination and filtering query_filter = self.request.GET.copy() if "page" in query_filter: del query_filter["page"] context['query_filter'] = query_filter return context
def render(self, context): """ This class has to be able to deal with two classes essentially... NestedModelForm and BaseFormset. Key thing to note here is that when we get a BaseFormset, what is happening is that the form associated with that BaseFormset has children. """ top_level = self.top_level actual_form = self.form_var.resolve(context) is_formset = issubclass(actual_form.__class__, BaseFormSet) form_name = get_form_name(actual_form) if not is_formset else get_form_name(actual_form.parent_form) # print("== Rendering %s (Formset: %s) " % (form_name, is_formset)) if self.helper is not None: actual_helper = self.helper_var.resolve(context) else: actual_helper = get_default_helper() if not hasattr(actual_form, "helper") else actual_form.helper if actual_helper.form_tag: actual_helper.form_tag = False # raise template.TemplateSyntaxError("form_tag cannot be True on the helper, please go and rectify that") # Place a link on the formset back to its parent form if not is_formset and hasattr(actual_form, "inline_form"): actual_form.inline_form.parent_form = actual_form """ Basically we create a node list and all the following things to it: - <div id='{form_name}_form_div' class='form-container'> - HtmlContent - Fields from the parent form - The inline form which prints the children and management form (hidden) - <div id='{form_name}_children_div' class='form-children'> --- Kids printed here --- </div> - <div id='{form_name}_management_form_div' class='management-form-div'> - Management form (hidden) - Inline actions form (if one exists) - </div> - </div> Then we return nodelist.render """ # Add the forms to the nodelist nodelist = NodeList() # Add the main form to our node list # === PRINT THE PARENT FORM if not is_formset: form_div_class = "%s_form_div" % form_name # print("Creating form div class: %s" %form_div_class) nodelist.append(HtmlContent("<div id='%s' class='form-container'>" % form_div_class)) nodelist.append(CrispyFormNode(form=self.form, helper=self.helper)) # === PRINT THE KIDS if is_formset: # e.g. BuildingFormSet # We need to add each form AND print the management form # Add a DIV for the children children_div_class = "%s_children_div" % form_name nodelist.append(HtmlContent("<div id='%s' class='form-children'>" % children_div_class)) for child_index in range(len(actual_form.forms)): child_form = actual_form.forms[child_index] if not hasattr(child_form, "helper"): child_form.helper = get_default_helper() child_form_name = "%s_%s" % (get_form_name(child_form), child_index) # print(" Adding %s to the nodelist" % child_form_name) child_form_helper_name = "%s_helper" % child_form_name context[child_form_name] = child_form context[child_form_helper_name] = child_form.helper process_helper(child_form.helper) if hasattr(child_form, "inline_form"): # print(" %s is a NestedModelForm, wrapping it in a nested node" % child_form_name) nodelist.append(NestedFormNode(child_form_name, child_form_helper_name, top_level=False)) else: # print(" %s (%s) is NOT a NestedModelForm, wrapping it in a crispy node" % (child_form_name, child_form.__class__)) nodelist.append(CrispyFormNode(child_form_name, child_form_helper_name)) nodelist.append(HtmlContent("</div>")) # We need to print the management form for these kids management_form_helper = FormHelper() management_form_helper.form_tag = False management_form_helper.disable_csrf = True management_form = actual_form.management_form context["%s_management_form" % form_name] = management_form context["%s_management_form_helper" % form_name] = management_form_helper # Place a data binding on the management form for KnockoutJS fields = management_form.fields fields["TOTAL_FORMS"].widget.attrs["data-bind"] = "value: totalForms" fields["INITIAL_FORMS"].widget.attrs["data-bind"] = "value: initialForms" fields["MAX_NUM_FORMS"].widget.attrs["data-bind"] = "value: maxForms" # Let Crispy handle the printing of this... # print("Adding %s management_form to the node list" % form_name) # Add a div for the management form management_form_div_class = get_management_form_div_name(actual_form.parent_form) nodelist.append(HtmlContent("<div id='%s' class='management-form-div'>" % management_form_div_class)) nodelist.append(CrispyFormNode("%s_management_form" % form_name, "%s_management_form_helper" % form_name)) # Check if there is an inline form if hasattr(actual_form, "actions_form") and actual_form.actions_form is not None: inline_actions_form_name = "%s-inline_actions_form" % get_form_name(actual_form.actions_form) inline_actions_form_helper_name = "%s-helper" % inline_actions_form_name context[inline_actions_form_name] = actual_form.actions_form context[inline_actions_form_helper_name] = actual_form.actions_form().helper nodelist.append(CrispyFormNode(form=inline_actions_form_name, helper=inline_actions_form_helper_name)) nodelist.append(HtmlContent("</div>")) else: # not a formset """ We have two cases to deal with here: - BlockForm - it has an inline form that we need to print here - TenantForm - no inline form to worry about... If it has an inline form, note that we need to make a NestedModelNode """ if hasattr(actual_form, "inline_form"): context["%s_inline_form" % form_name] = actual_form.inline_form nodelist.append(NestedFormNode("%s_inline_form" % form_name, self.helper, top_level=False)) if not is_formset: # we didn't add this if it was a formset nodelist.append(HtmlContent("</div>")) # for the form if top_level: # print out ALL the script templates nodelist.append(KnockoutFormTemplate(self.form)) return nodelist.render(context)
def extra_context(self): helper = FormHelper() helper.form_tag = False helper.disable_csrf = True return {"search_helper": helper}
def test_disable_csrf(self): form = TestForm() helper = FormHelper() helper.disable_csrf = True html = render_crispy_form(form, helper, {'csrf_token': _get_new_csrf_key()}) self.assertFalse('csrf' in html)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) helper = FormHelper() helper.layout = Layout( Div( Field( "gm", template="crispy/floating-labels.html", wrapper_class="col-12 col-md-6 col-lg px-1 mb-lg-0", title=__("GM") + " (" + __("active") + ")" if "gm" in self.active_filters else __("GM"), css_class="filter-active" if "gm" in self.active_filters else "", ), Field( "workweek", template="crispy/floating-labels.html", wrapper_class="col-12 col-md-6 col-lg px-1 mb-lg-0", title=__("Workweek") + " (" + __("active") + ")" if "workweek" in self.active_filters else __("Workweek"), css_class="filter-active" if "workweek" in self.active_filters else "", ), Field( "categories", template="crispy/floating-labels.html", wrapper_class="col-12 col-md-6 col-lg px-1 mb-lg-0", title=__("Categories") + " (" + __("active") + ")" if "categories" in self.active_filters else __("Categories"), css_class="filter-active" if "categories" in self.active_filters else "", ), Field( "is_custom_material", template="crispy/floating-labels.html", wrapper_class="col-12 col-md-6 col-lg px-1 mb-lg-0", title=__("Custom material") + " (" + __("active") + ")" if "is_custom_material" in self.active_filters else __("Custom material"), css_class="filter-active" if "is_custom_material" in self.active_filters else "", ), Div( Submit( "filter", _("Apply filters"), css_class="btn-secondary", ), HTML( '<a href="?" class="btn btn-outline-secondary">{}</a>'.format( _("Clear") ) ), css_class="col-12 col-lg-auto px-1 mb-xl-0 form-label-group mb-md-0", ), css_class="row mx-0", ), ) helper.form_class = "form-inline" helper.disable_csrf = True self.helper = helper
def translation_helper(instance=None, prefix='', form_tag=False): """ Catalog's message translations form layout helper """ helper = FormHelper() helper.form_action = '.' helper.form_class = 'catalog-messages-form' helper.form_tag = form_tag helper.disable_csrf = True # Does not seems to have real effect helper.render_required_fields = True # Define base css classes row_css_classes = ['message-row', 'clearfix'] if instance.fuzzy: row_css_classes.append('fuzzy') elif not instance.message: row_css_classes.append('disabled empty') else: row_css_classes.append('enabled') # Build anchor link and id anchor_link = '' if prefix: prefix_id = int(prefix[len('form-'):]) + 1 anchor_link = '<a href="#item-{0}" id="item-{0}">#{0}</a>'.format(prefix_id) # Build messages, at least the singular message message_contents = [Div( Div( HTML( source_formatter(instance.template.message) ), css_class='flex-item source', ), Field( 'message', placeholder=_("Type your translation here else the original text will be used"), wrapper_class='flex-item edit', ), css_class='flex-container', ), # Little trick to hide the field because formset requires the same # fields for all items HiddenField('plural_message') ] # If plural is enabled, build the plural message and append it if instance.pluralizable: row_css_classes.append('pluralizable') # Remove hidden field message_contents.pop() # Append plural field message_contents.append(Div( Div( HTML( source_formatter(instance.template.plural_message) ), css_class='flex-item source', ), Field( 'plural_message', placeholder=_("Type your translation here else the original text will be used"), wrapper_class='flex-item edit', ), css_class='flex-container', )) helper.layout = Layout( Div( Div( HTML(anchor_link), css_class='anchor', ), Div( Div( 'fuzzy', css_class='fuzzy-field', ), *message_contents, css_class=' '.join(row_css_classes) ), Div( HTML('<p class="title"><i class="icon-eye"></i> '), HTML(_('Locations')), HTML('</p>'), HTML( build_locations(instance.template.get_locations_set()), ), css_class='locations', ), css_class='row-wrapper', ), ) return helper
def extra_context(self): helper = FormHelper() helper.form_tag = False helper.disable_csrf = True return {"search_helper": helper}
def test_disable_csrf(): form = SampleForm() helper = FormHelper() helper.disable_csrf = True html = render_crispy_form(form, helper, {'csrf_token': _get_new_csrf_key()}) assert 'csrf' not in html
def exam_edit(request, course_code, exam_id): course, _ = course_auth(request, course_code, instructor=True) exam = get_object_or_404( Exam, pk=exam_id, course=course, ) if request.method == 'POST': # Populate form with request data form = ExamEditForm(request.POST, instance=exam) timeslot_formset = TimeSlotFormSet( request.POST, instance=exam, ) examslot_formset = ExamSlotFormSet( request.POST, instance=exam, ) # Check for validity if (form.is_valid() and timeslot_formset.is_valid() and examslot_formset.is_valid()): form.save() timeslot_formset.save() examslot_formset.save() messages.success( request, "The exam was updated successfully.", ) return HttpResponseRedirect( reverse( 'registration:exam-detail', args=[course.code, exam.pk], )) else: messages.error( request, "Please correct the error below.", ) else: # Create default form form = ExamEditForm(instance=exam) timeslot_formset = TimeSlotFormSet(instance=exam) examslot_formset = ExamSlotFormSet(instance=exam) timeslot_helper = FormHelper() timeslot_helper.template = 'bootstrap4/table_inline_formset.html' timeslot_helper.form_tag = False timeslot_helper.disable_csrf = True examslot_helper = FormHelper() examslot_helper.template = 'bootstrap4/table_inline_formset.html' examslot_helper.form_tag = False examslot_helper.disable_csrf = True return render( request, 'registration/exam_edit.html', { 'course': course, 'timeslot_formset': timeslot_formset, 'timeslot_helper': timeslot_helper, 'examslot_formset': examslot_formset, 'examslot_helper': examslot_helper, 'exam': exam, 'form': form, })
def test_disable_csrf(): form = TestForm() helper = FormHelper() helper.disable_csrf = True html = render_crispy_form(form, helper, {"csrf_token": _get_new_csrf_key()}) assert "csrf" not in html
def translation_helper(instance=None, prefix='', form_tag=False): """ Catalog's message translations form layout helper """ helper = FormHelper() helper.form_action = '.' helper.form_class = 'catalog-messages-form' helper.form_tag = form_tag helper.disable_csrf = True # Does not seems to have real effect helper.render_required_fields = True # Define base css classes row_css_classes = ['message-row', 'clearfix'] if instance.fuzzy: row_css_classes.append('fuzzy') elif not instance.message: row_css_classes.append('disabled empty') else: row_css_classes.append('enabled') # Build anchor link and id anchor_link = '' if prefix: prefix_id = int(prefix[len('form-'):]) + 1 anchor_link = '<a href="#item-{0}" id="item-{0}">#{0}</a>'.format(prefix_id) # Build messages, at least the singular message message_contents = [Div( Div( HTML( source_formatter(instance.template.message) ), css_class='flex-item source', ), Field( 'message', placeholder=_("Type your translation here else the original text will be used"), wrapper_class='flex-item edit', ), css_class='flex-container', ), # Little trick to hide the field because formset requires the same # fields for all items HiddenField('plural_message') ] # If plural is enabled, build the plural message and append it if instance.pluralizable: row_css_classes.append('pluralizable') # Remove hidden field message_contents.pop() # Append plural field message_contents.append(Div( Div( HTML( source_formatter(instance.template.plural_message) ), css_class='flex-item source', ), Field( 'plural_message', placeholder=_("Type your translation here else the original text will be used"), wrapper_class='flex-item edit', ), css_class='flex-container', )) helper.layout = Layout( Div( Div( HTML(anchor_link), css_class='anchor', ), Div( Div( 'fuzzy', css_class='fuzzy-field', ), *message_contents, css_class=' '.join(row_css_classes) ), Div( HTML('<p class="title"><i class="icon-eye"></i> '), HTML(_('Locations')), HTML('</p>'), HTML( build_locations(instance.template.get_locations_set()), ), css_class='locations', ), css_class='row-wrapper', ), ) return helper