[UPDT] HORILLA WIDGETS: Add disable option if widget value does not exist
This commit is contained in:
@@ -10,6 +10,8 @@ from django import forms
|
||||
|
||||
from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField
|
||||
|
||||
forms.Select.option_template_name = "horilla_widgets/select_option.html"
|
||||
|
||||
|
||||
class HorillaForm(forms.Form):
|
||||
def clean(self) -> Dict[str, Any]:
|
||||
|
||||
1
horilla_widgets/templates/horilla_widgets/attr.html
Normal file
1
horilla_widgets/templates/horilla_widgets/attr.html
Normal file
@@ -0,0 +1 @@
|
||||
{% for name, value in widget.attrs.items %}{% if value is not False %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %}
|
||||
@@ -0,0 +1 @@
|
||||
<option value="{{ widget.value|stringformat:'s' }}" {% include "horilla_widgets/attr.html" %} {% if not widget.value %}disabled{% endif %}>{{ widget.label }}{{widget.disable_option}}</option>
|
||||
Reference in New Issue
Block a user