[UPDT] BASE: Base template common form html

This commit is contained in:
Horilla
2024-09-23 17:11:02 +05:30
parent 5e8b8d3a00
commit 84e37aef06

View File

@@ -1,56 +1,52 @@
{% load i18n %}{% load widget_tweaks %} {% load horillafilters %} {% load i18n %}{% load widget_tweaks %} {% load horillafilters %}
{% for field in form %} {% for field in form %}
{% if field.field.widget.is_hidden %} {% if field.field.widget.is_hidden %}
{{ field }} {{ field }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<div class="oh-general__tab-target oh-profile-section" id="personal"> <div class="oh-general__tab-target oh-profile-section" id="personal">
<div class="oh-profile-section__card"> <div class="oh-profile-section__card">
<div class="row"> <div class="row">
<div class="col-12">{{form.non_field_errors}}</div> <div class="col-12">{{form.non_field_errors}}</div>
{% for field in form.visible_fields %} {% for field in form.visible_fields %}
{% if field.field.widget|is_select_multiple or field.field.widget|is_text_area %} {% if field.field.widget|is_select_multiple or field.field.widget|is_text_area %}
<label <div class="oh-label__info" for="id_{{ field.name }}">
class="oh-label {% if field.field.required %} required-star{% endif %}" <label class="oh-label {% if field.field.required %} required-star{% endif %}"
for="id_{{ field.name }}" for="id_{{ field.name }}">{% trans field.label %}</label>
title="{{ field.help_text|safe }}" {% if field.help_text != '' %}
>{% trans field.label %}</label <span class="oh-info mr-2" title="{{ field.help_text|safe }}"></span>
> {% endif %}
<div style="width: 100%; padding: 12px;" id="id_{{ field.name }}_parent_div"> </div>
<div style="width: 100%; padding: 12px;" id="id_{{ field.name }}_parent_div">
{{ field|add_class:"form-control" }} {{ field|add_class:"form-control" }}
</div> </div>
{{field.errors}} {{field.errors}}
{% else %} {% else %}
<div class="col-12 col-md-6" id="id_{{ field.name }}_parent_div"> <div class="col-12 col-md-6" id="id_{{ field.name }}_parent_div">
<label <div class="oh-label__info" for="id_{{ field.name }}">
class="oh-label {% if field.field.required %} required-star{% endif %}" <label class="oh-label {% if field.field.required %} required-star{% endif %}"
for="id_{{ field.name }}" for="id_{{ field.name }}">{% trans field.label %}</label>
title="{{ field.help_text|safe }}" {% if field.help_text != '' %}
>{% trans field.label %}</label <span class="oh-info mr-2" title="{{ field.help_text|safe }}"></span>
> {% endif %}
{% if field.field.widget.input_type == "checkbox" %} </div>
<div class="oh-switch" style="width: 30px"> {% if field.field.widget.input_type == "checkbox" %}
{{ field|add_class:"oh-switch__checkbox" }} <div class="oh-switch" style="width: 30px">
{{ field|add_class:"oh-switch__checkbox" }}
</div> </div>
{% else %} {% else %}
{{ field|add_class:"form-control" }} {{ field|add_class:"form-control" }}
{% endif %} {% endif %}
{{field.errors}} {{field.errors}}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div>
<div class="oh-modal__dialog-footer p-0 mt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</div> </div>
<div class="oh-modal__dialog-footer p-0 mt-3">
<button
type="submit"
class="oh-btn oh-btn--secondary oh-btn--shadow"
>
{% trans "Save" %}
</button>
</div>
</div>
</div> </div>