Private
Public Access
1
0

age calculations

This commit is contained in:
Sander Roosendaal
2018-04-27 09:30:03 +02:00
parent 0a72e1961f
commit 3ba9bbf93a
2 changed files with 8 additions and 2 deletions

View File

@@ -294,7 +294,10 @@ from datetime import date
def calculate_age(born):
today = date.today()
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
if born:
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
else:
return None
def my_dict_from_instance(instance,model):
thedict = {}