mainapp/utils.py
def formatday(self, day, weekday, bookings, theyear, themonth):
        """
        Return a day as a table cell.
        """

        if day == 0: #empty cells
          return '<td class="noday">&nbsp;</td>'

        bookings_from_day = bookings.filter(book_date__day=day).count()
        target_date = str(theyear) + '-' + str(themonth) + '-' + str(day)

        if bookings_from_day is 0:
          bookings_html = '<br />'
        elif bookings_from_day is 19: # TODO replace by setting value - 1
          bookings_html = '<h2 class="text-warning">' + '<br />' + str(bookings_from_day) + '</h2>'
        elif bookings_from_day is 20: # TODO replace by setting value
          bookings_html = '<h2 class="text-danger">' + '<br />' + str(bookings_from_day) + '</h2>'
        else:
          bookings_html = '<h2>' + '<br />' + str(bookings_from_day) + '</h2>'

        if date(year=2021, month=10, day=3) < date(year=theyear, month=themonth, day=day):
          bookings_html += '<a href="/date_details?date=%s">Details</a>' % target_date
        return '<td class="align-top %s">%d%s</td>' % (self.cssclasses[weekday], day, mark_safe(bookings_html))

        Return a day as a table cell.
        
Return a day as a table cell.
Return a day as a table cell .
def formatday(self, day, weekday, bookings, theyear, themonth):
        if day == 0: 
          return '<td class="noday">&nbsp;</td>'
        bookings_from_day = bookings.filter(book_date__day=day).count()
        target_date = str(theyear) + '-' + str(themonth) + '-' + str(day)
        if bookings_from_day is 0:
          bookings_html = '<br />'
        elif bookings_from_day is 19: 
          bookings_html = '<h2 class="text-warning">' + '<br />' + str(bookings_from_day) + '</h2>'
        elif bookings_from_day is 20: 
          bookings_html = '<h2 class="text-danger">' + '<br />' + str(bookings_from_day) + '</h2>'
        else:
          bookings_html = '<h2>' + '<br />' + str(bookings_from_day) + '</h2>'
        if date(year=2021, month=10, day=3) < date(year=theyear, month=themonth, day=day):
          bookings_html += '<a href="/date_details?date=%s">Details</a>' % target_date
        return '<td class="align-top %s">%d%s</td>' % (self.cssclasses[weekday], day, mark_safe(bookings_html))
def formatday ( self , day , weekday , bookings , theyear , themonth ) : if day == 0 : return '<td class="noday">&nbsp;</td>' bookings_from_day = bookings . filter ( book_date__day = day ) . count ( ) target_date = str ( theyear ) + '-' + str ( themonth ) + '-' + str ( day ) if bookings_from_day is 0 : bookings_html = '<br />' elif bookings_from_day is 19 : bookings_html = '<h2 class="text-warning">' + '<br />' + str ( bookings_from_day ) + '</h2>' elif bookings_from_day is 20 : bookings_html = '<h2 class="text-danger">' + '<br />' + str ( bookings_from_day ) + '</h2>' else : bookings_html = '<h2>' + '<br />' + str ( bookings_from_day ) + '</h2>' if date ( year = 2021 , month = 10 , day = 3 ) < date ( year = theyear , month = themonth , day = day ) : bookings_html += '<a href="/date_details?date=%s">Details</a>' % target_date return '<td class="align-top %s">%d%s</td>' % ( self . cssclasses [ weekday ] , day , mark_safe ( bookings_html ) )
Return a day as a table cell.
Return a day as a table cell .
"""
        Return a day as a table cell.
        """ #empty cells # TODO replace by setting value - 1 # TODO replace by setting value
self
day
weekday
bookings
theyear
themonth