Something went wrong. Try again.
Code Review Workflow for IT Programming at BCTC West
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899{% extends base_template %}
{% comment %} This file acts as a base for all forms It automatically handles fields, help text, errors, and more{% endcomment %}
{% block resources %} {% load static %} <script defer src="{% static "js/form.js" %}"></script> {{ form.media }}{% endblock %}
{% block containerClass %}container{% endblock %}
{% block pageHeader %}{{ formName }}{% endblock %}
{% block belowHeader %}<h5 class="text-center">{{ non_field_help_text }}</h5>{% endblock %}
{% block mainContent %} {% load form_tags %} <div class="row mb-5"> <div class="col"> {% if hide_back is not True %} <button type="button" class="btn btn-outline-secondary back-button d-inline"><i class="bi bi-arrow-left"></i> Back </button> {% endif %} </div> <div class="col text-end"> <button class="btn btn-outline-secondary d-none" aria-label="Display help text" id="help-button" type="button" data-bs-toggle="collapse" data-bs-target=".field-help" aria-expanded="false" aria-controls="{{ field.name }}-helptext"> <i class="bi bi-question-circle"></i> <span id="help-label">Show Help</span> </button> </div> </div> <div class="row mb-4"> <div class="col"> <form novalidate class="form form-main" method="POST"> {% csrf_token %} {% for field in form %} <div id="{{ field.label }}_fieldset" class="my-4"> {% if render_no_floating %} {% if field|is_checkbox %} <div class="form-check form-switch"> <label class="form-check-label" id="{{ field.label }}_label" for="{{ field.id_for_label }}"> {{ field.label|title }}</label> {{ field|setup_checkbox }} </div> {% else %} <label id="{{ field.label }}_label" class="mb-3" for="{{ field.id_for_label }}">{{ field.label|title }}</label> {{ field|setup_field:False }} {% endif %} {% elif field in form.visible_fields %} <div class="form-floating"> {{ field|setup_field:True }} <label id="{{ field.label }}_label" for="{{ field.id_for_label }}">{{ field.label|title }}</label> </div> {% else %} {{ field|setup_field:"form-control" }} {% endif %} {% if field.help_text %} <div class="mb-2 d-flex flex-row"> <div class="collapse text-nowrap ms-2 mt-1 align-middle field-help" id="{{ field.name }}-helptext"> {{ field.help_text }} </div> </div> {% endif %} {% if field.errors %} <div style="display: block;" id="{{ field.name }}-feedback" class="invalid-feedback"> <ul> {% for error in field.errors %} <li>{{ error }}</li> {% endfor %} </ul> </div> {% endif %} </div> {% endfor %} {% block beforeSubmit %} {# This block is used to put elements directly before the submit button #} {% endblock %} <button class="btn mt-4 w-100 btn-outline-primary submit-button" type="submit"> <span class="loading spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span> <span class="submit-word">{% block submitWord %}Save {# This block can be overriden to change what word appears in the submit button #} {% endblock %}</span> </button> </form> </div> </div>{% endblock %}