From fe513c56f7320d36016214cd6848dc7992a3e97d Mon Sep 17 00:00:00 2001 From: Horilla Date: Tue, 29 Oct 2024 10:37:25 +0530 Subject: [PATCH] [UPDT] HORILLA WODGETS: Add Django default select option template --- horilla_widgets/forms.py | 2 +- horilla_widgets/templates/horilla_widgets/attr.html | 2 +- horilla_widgets/templates/horilla_widgets/horilla_attr.html | 1 + .../templates/horilla_widgets/horilla_select_option.html | 1 + horilla_widgets/templates/horilla_widgets/select_option.html | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 horilla_widgets/templates/horilla_widgets/horilla_attr.html create mode 100644 horilla_widgets/templates/horilla_widgets/horilla_select_option.html diff --git a/horilla_widgets/forms.py b/horilla_widgets/forms.py index 00f15363d..e2020d1fe 100644 --- a/horilla_widgets/forms.py +++ b/horilla_widgets/forms.py @@ -10,7 +10,7 @@ from django import forms from horilla_widgets.widgets.horilla_multi_select_field import HorillaMultiSelectField -forms.Select.option_template_name = "horilla_widgets/select_option.html" +forms.Select.option_template_name = "horilla_widgets/horilla_select_option.html" class HorillaForm(forms.Form): diff --git a/horilla_widgets/templates/horilla_widgets/attr.html b/horilla_widgets/templates/horilla_widgets/attr.html index c52de9eea..029f04457 100644 --- a/horilla_widgets/templates/horilla_widgets/attr.html +++ b/horilla_widgets/templates/horilla_widgets/attr.html @@ -1 +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 %} +{% for name, value in attrs.items %}{% if value is not False %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %} diff --git a/horilla_widgets/templates/horilla_widgets/horilla_attr.html b/horilla_widgets/templates/horilla_widgets/horilla_attr.html new file mode 100644 index 000000000..7a5592afc --- /dev/null +++ b/horilla_widgets/templates/horilla_widgets/horilla_attr.html @@ -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 %} \ No newline at end of file diff --git a/horilla_widgets/templates/horilla_widgets/horilla_select_option.html b/horilla_widgets/templates/horilla_widgets/horilla_select_option.html new file mode 100644 index 000000000..ddfcd70b8 --- /dev/null +++ b/horilla_widgets/templates/horilla_widgets/horilla_select_option.html @@ -0,0 +1 @@ + diff --git a/horilla_widgets/templates/horilla_widgets/select_option.html b/horilla_widgets/templates/horilla_widgets/select_option.html index 1863b118a..3933c5ab8 100644 --- a/horilla_widgets/templates/horilla_widgets/select_option.html +++ b/horilla_widgets/templates/horilla_widgets/select_option.html @@ -1 +1 @@ - +