Révision 9f237a5a
Ajouté par Frédéric Péters il y a plus de 9 ans
calebasse/dossiers/models.py | ||
---|---|---|
368 | 368 |
return None |
369 | 369 |
return None |
370 | 370 |
|
371 |
def age(self): |
|
372 |
if not self.birthdate: |
|
373 |
return 'inconnu' |
|
374 |
now = datetime.today().date() |
|
375 |
age = relativedelta(now, self.birthdate) |
|
376 |
if age.years < 2: |
|
377 |
# for children < 2 years, return the number of months |
|
378 |
months = age.years * 12 + age.months |
|
379 |
if months: |
|
380 |
return '%s mois' % months |
|
381 |
return '%s jours' % age.days |
|
382 |
return '%s ans' % age.years |
|
383 |
|
|
371 | 384 |
|
372 | 385 |
class PatientRecordManager(models.Manager): |
373 | 386 |
def for_service(self, service): |
Formats disponibles : Unified diff
display age next to birthdate in dossier main page (#3429)