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
    
    Your transaction has been successfully processed! Thank you for your purchase :)
                            
Parameters (all optional)
                            - alert_content- The content of the alert
- alert_class- Sets additional- classattributes
- alert_type- Sets the alert type. One of 'success', 'info', 'warning', 'danger' (default:- success)
- alert_fixed- pass- alert_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
    
    
    Inspect element to view generated HTML
                            
Parameters (all optional)
                            - ip_label- The associated label content
- ip_id- Sets- idattribute
- ip_name- Sets- nameattribute
- ip_type- Sets- typeattribute
- ip_value- Sets- valueattribute
- ip_placeholder- Sets- placeholderattribute
- ip_help- Sets the help text below the control
- ip_class- Sets- classattributes (default:- bg-success-50)
- ip_required- Set- ip_required=1to include a required="true" attribute
- ip_grouped- Whether to wrap the input into a- div.form-groupelement.