[UPDT] BASE: Add function and templates for upcoming holidays card list

This commit is contained in:
Horilla
2024-12-06 16:00:58 +05:30
parent 3845baad49
commit 55c93338db
4 changed files with 64 additions and 0 deletions

View File

@@ -1647,6 +1647,20 @@ class Holidays(HorillaModel):
def __str__(self):
return self.name
def today_holidays(today=None) -> models.QuerySet:
"""
Retrieve holidays that overlap with the given date (default is today).
Args:
today (date, optional): The date to check for holidays. Defaults to the current date.
Returns:
QuerySet: A queryset of `Holidays` instances where the given date falls between
`start_date` and `end_date` (inclusive).
"""
today = today or date.today()
return Holidays.objects.filter(start_date__lte=today, end_date__gte=today)
class CompanyLeaves(HorillaModel):
based_on_week = models.CharField(