Here's my filter code
from django import template
register = template.Library()
@register.filter()
def smooth_timedelta(timedeltaobj):
"""Convert a datetime.timedelta object into Days, Hours, Minutes, Seconds."""
secs = timedeltaobj.total_seconds()
timetot = ""
if secs > 86400: # 60sec 60min 24hrs
days = secs // 86400
timetot += "{} days".format(int(days))
secs = secs - days*86400
if secs > 3600:
hrs = secs // 3600
timetot += " {} hours".format(int(hrs))
secs = secs - hrs*3600
if secs > 60:
mins = secs // 60
timetot += " {} minutes".format(int(mins))
secs = secs - mins*60
if secs > 0:
timetot += " {} seconds".format(int(secs))
return timetot
Then in my template I did
{% load smooth_timedelta %}
{% timedeltaobject|smooth_timedelta %}
-
https://stackoverflow.com/questions/16348003/displaying-a-timedelta-object-in-a-django-templateUn container pour émuler en local l'api metadata et ainsi endosser un role
https://github.com/awslabs/amazon-ecs-local-container-endpoints
-
https://aws.amazon.com/blogs/compute/a-guide-to-locally-testing-containers-with-amazon-ecs-local-endpoints-and-docker-compose/def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
return [ atoi(c) for c in re.split(r'(\d+)', text) ]
my_list.sort(key=natural_keys)
-
https://links.infomee.fr/?6OC8rwUn outils pour visualiser son schema
via Flavio
-
http://schemaspy.org/Au top pour faire des petits helper en cmd line
-
https://pypi.org/project/simple-term-menu/J'utilisais https://hub.github.com/ jusqu'a present mais je vais surement changer, github cli a l'air plus intuitif et interactif
-
https://github.blog/2020-09-17-github-cli-1-0-is-now-available/ce petit projet a l'air top mais j'ai tellement pris l'habitude d'utiliser shaarli pour stocker tout plein de choses
-
https://github.com/gnebbia/kbÇa c'est bien cool! Presque envie de prendre l'offre pro de Feedly
-
https://blog.feedly.com/get-newsletters-in-feedly/