Marietje 4.1: Addition of Django REST framework, Swagger, Dark mode and updates to Django and Bootstrap

This commit is contained in:
Lars van Rhijn
2023-09-14 19:55:51 +02:00
parent 379ababcc0
commit d1a1be7e2e
124 changed files with 4835 additions and 3490 deletions

View File

@ -0,0 +1,13 @@
from datetime import datetime, timedelta
def age_text(last_updated):
current_age = datetime.now() - last_updated
minutes = (current_age.seconds % 3600) / 60
hours = current_age.seconds / 3600
minutestr = "minute" if minutes == 1 else "minutes"
hourstr = "hour" if hours == 1 else "hours"
if current_age < timedelta(hours=1):
return "Stats were updated {:.0f} {} ago.".format(minutes, minutestr)
return "Stats were updated {:.0f} {} and {:.0f} {} ago.".format(hours, hourstr, minutes, minutestr)