[UPDT] BASE: Updated CompanyLeave form __init__

This commit is contained in:
Horilla
2025-10-20 17:35:14 +05:30
parent 34f76f2642
commit 1dc11c8da0
2 changed files with 3 additions and 1 deletions

View File

@@ -2771,6 +2771,8 @@ class CompanyLeaveForm(ModelForm):
Custom initialization to configure the 'based_on' field.
"""
super().__init__(*args, **kwargs)
choices = [("", "All")] + list(self.fields["based_on_week"].choices[1:])
self.fields["based_on_week"].choices = choices
self.fields["based_on_week"].widget.option_template_name = (
"horilla_widgets/select_option.html"
)

View File

@@ -1 +1 @@
<option value="{{ widget.value|stringformat:'s' }}" {% include "horilla_widgets/attr.html" %}>{{ widget.label }}</option>
<option value="{{ widget.value|stringformat:'s' }}" {% include "horilla_widgets/attr.html" %} {% if widget.selected %} selected="selected"{% endif %} >{{ widget.label }}</option>