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 alertalert_class
- Sets additionalclass
attributesalert_type
- Sets the alert type. One of 'success', 'info', 'warning', 'danger' (default:success
)alert_fixed
- passalert_fixed=1
to 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 contentip_id
- Setsid
attributeip_name
- Setsname
attributeip_type
- Setstype
attributeip_value
- Setsvalue
attributeip_placeholder
- Setsplaceholder
attributeip_help
- Sets the help text below the controlip_class
- Setsclass
attributes (default:bg-success-50
)ip_required
- Setip_required=1
to include a required="true" attributeip_grouped
- Whether to wrap the input into adiv.form-group
element.