Fixed get_age

This commit is contained in:
Antoine Bartuccio 2016-09-04 16:24:31 +02:00
parent e1ce661a04
commit 80549c7a33

View File

@ -305,7 +305,9 @@ class User(AbstractBaseUser):
"""
Returns the age
"""
return timezone.now().year - self.date_of_birth.year
today = timezone.now()
born = self.date_of_birth
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
def email_user(self, subject, message, from_email=None, **kwargs):
"""