Improve age management for getting products and make get_product a part of counter model

This commit is contained in:
2024-12-22 12:27:58 +01:00
parent 372470b44b
commit eed434aeb2
4 changed files with 33 additions and 44 deletions

View File

@ -578,14 +578,6 @@ class User(AbstractUser):
return "%s (%s)" % (self.get_full_name(), self.nick_name)
return self.get_full_name()
def get_age(self):
"""Returns the age."""
today = timezone.now()
born = self.date_of_birth
return (
today.year - born.year - ((today.month, today.day) < (born.month, born.day))
)
def get_family(
self,
godfathers_depth: NonNegativeInt = 4,