Exemple #1
0
class GirotondoCalendar(LoginRequiredMixin, CalendarPage):
    class Meta:
        verbose_name = "Girotondo Calendar"

    show_in_menus_default = True

    def get_context(self, request, *args, **kwargs):
        self.holidays = Holidays()
        for absence in Absence.get_absence_queryset_by_user(request.user):
            if absence.deleted:
                continue
            self.holidays.add(
                absence.from_date,
                absence.child_link.first_name + ' ' + absence.remark)
        ctx = super().get_context(request, *args, **kwargs)
        return ctx

    subpage_types = [
        RecurringEventPage, MultidayRecurringEventPage, MultidayEventPage,
        SimpleEventPage
    ]
Exemple #2
0
 def testAdd(self):
     ausHols = Holidays(None)
     ausHols.add(dt.date(2020, 10, 20), "Kangaroo Day")
     ausHols.register(AU())
     nzHols = Holidays(None)
     nzHols.add(dt.date(2020, 10, 20), "Kiwi Day")
     nzHols.register(NZ())
     tasHols = ausHols + nzHols
     self.assertEqual(tasHols.get(dt.date(2020, 10, 20)),
                      "Kangaroo Day, Kiwi Day")
     self.assertEqual(len(tasHols.srcs), 3)
     self.assertIs(type(tasHols.srcs[0]), dict)
     self.assertIs(type(tasHols.srcs[1]), AU)
     self.assertIs(type(tasHols.srcs[2]), NZ)
     self.assertEqual(tasHols.names(), [
         "New Year's Day", "Day after New Year's Day",
         "New Year's Day (Observed)", "Day after New Year's Day (Observed)",
         'Australia Day', 'Australia Day (Observed)', 'Waitangi Day',
         'Waitangi Day (Observed)', 'Good Friday', 'Easter Monday',
         'Anzac Day', 'Anzac Day (Observed)', "Queen's Birthday",
         'Kangaroo Day', 'Kiwi Day', 'Labour Day', 'Christmas Day',
         'Boxing Day', 'Christmas Day (Observed)', 'Boxing Day (Observed)'
     ])
Exemple #3
0
 def testSimpleNames(self):
     hols = Holidays()
     hols.add(dt.date(2021, 4, 29), "HAPPY HAPPY")
     self.assertEqual(hols.names(), ["HAPPY HAPPY"])
Exemple #4
0
 def testMultiHolidays(self):
     hols = Holidays()
     hols.add(dt.date(1999, 1, 1), "Gliffy")
     hols.add(dt.date(1999, 1, 1), "Whatnot")
     self.assertEqual(hols.get(dt.date(1999, 1, 1)),
                      "Gliffy, Whatnot, New Year's Day")
Exemple #5
0
 def testSimple(self):
     hols = Holidays()
     hols.add(dt.date(1999, 4, 29), "HAPPY HAPPY")
     self.assertEqual(hols.get(dt.date(1999, 4, 29)), "HAPPY HAPPY")