Django Template Controls Django templates to help construct common HTML controls.
The examples below use templates included from the sadjcore Django app.
You can use them just like any other Django templates, to quickly add common controls to your pages with reliable Smartadmin formatting and layout.
Alert Template
Django Template Entry
{% include 'sadjcore/controls/alert.html' with alert_class='m-0' alert_content='Your transaction has been successfully processed! Thank you for your purchase :)' %}
Result
Parameters (all optional)
alert_content- The content of the alertalert_class- Sets additionalclassattributesalert_type- Sets the alert type. One of 'success', 'info', 'warning', 'danger' (default:success)alert_fixed- passalert_fixed=1to remove the 'dismiss' button. Defaults to a dissmissable alert with button.
Input Template
Django Template Entry
{% include 'sadjcore/controls/input.html' with ip_label='Email' ip_type='email' ip_name='email' ip_placeholder='Please enter a valid email' ip_help='Inspect element to view generated HTML' ip_grouped=1 ip_id='email-input' %}
Result
Parameters (all optional)
ip_label- The associated label contentip_id- Setsidattributeip_name- Setsnameattributeip_type- Setstypeattributeip_value- Setsvalueattributeip_placeholder- Setsplaceholderattributeip_help- Sets the help text below the controlip_class- Setsclassattributes (default:bg-success-50)ip_required- Setip_required=1to include a required="true" attributeip_grouped- Whether to wrap the input into adiv.form-groupelement.