{% comment "" %} needs following context: - stock: Creates a modal with id = change_stock-modal-{{stock.id}} {% endcomment %} {% load crispy_forms_tags %} {% load static %} <div class="modal fade" id="change-stock-modal-{{stock.id}}"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <div class="flex-shrink-0"> {% if stock.component.get_resolved_image %} <img src="{{stock.component.get_resolved_image}}" style="max-width:64px;max-height:64px;" alt="{{ low.component.name }}" class="mr-3"> {% else %} <img src="{% static 'css/icons/card-image.svg' %}" style="width:64px;max-height:64px;" alt="{{ low.component.name }}" class="mr-3"> {% endif %} </div> <div class="flex-grow-1 ms-3"> <h6 class="mt-0 text-primary">{{ stock.component.name }}</h6> {% if stock.component.package %} Package: {{stock.component.package}}<br> {% endif %} {% if stock.component.manufacturer %} Manufacturer: {{stock.component.manufacturer}} {% endif %} </div> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <form method="post"> {% csrf_token %} <input type="hidden" name="stock_uuid" value="{{stock.id}}"> <div class="input-group mb-3"> <input type="submit" class="btn btn-primary" name="submit-amount-reduce" value="-"> <input type="number" name="amount" id="ch-stk-amount-{{stock.id}}" class="form-control" value="1" min="0" required> <input type="submit" class="btn btn-primary" name="submit-amount-increase" value="+"> </div> </form> <form method="post"> {% csrf_token %} <input type="hidden" name="stock_uuid" value="{{stock.id}}"> <div class="input-group mb-3"> <div class="input-group-text"> <input type="checkbox" class="form-check-input mt-0" name="watermark_active" id="ch-stk-watermark-act-{{stock.id}}" {% if stock.watermark >= 0 %}checked{%endif%}> </div> <input type="number" name="watermark" id="ch-stk-watermark-{{stock.id}}" class="form-control" value="{% if stock.watermark < 0 %}0{% else %}{{stock.watermark}}{% endif %}" required> <input type="submit" class="btn btn-primary" name="submit-edit-watermark" value="Update Watermark"> </div> </form> </div> </div> </div> </div>