1👍
✅
The simplest thing is just to pass the user to the class initialiser.
def __init__(self, holiday, user):
super(HolidayCalendar, self).__init__()
self.user = user
self.holiday = self.holiday_days(holiday)
def formatday(self, day, weekday):
...
if holiday_object.person_id == self.user:
and in your view:
cal = HolidayCalendar(my_holidays, request.user).formatmonth(year, month)
Source:stackexchange.com