[UPDT] BASE: Add function and templates for upcoming holidays card list
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user