[UPDT] BASE: Updated CompanyLeave form __init__

This commit is contained in:
Horilla
2025-10-21 15:45:45 +05:30
parent 5c975703f0
commit b038dffa46
2 changed files with 3 additions and 3 deletions

View File

@@ -3118,8 +3118,6 @@ class CompanyLeaveForm(ModelForm):
- exclude: A list of fields to exclude from the form (is_active).
"""
cols = {"based_on_week": 12, "based_on_week_day": 12}
class Meta:
"""
Meta class for additional options
@@ -3134,6 +3132,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>