djangosnippets.org: Latest snippets tagged with 'age'https://djangosnippets.org/tags/age/2008-01-21T15:23:52.410395-06:00Age - custom filter
2008-01-21T15:23:52.410395-06:00realmachttps://djangosnippets.org/snippets/557/<p>Based on the discussion at Empty Thoughts (http://blog.michaeltrier.com/2007/8/6/age-in-years-calculation) I built a quick and dirty custom filter.</p>
<p>Save this as a file in your "templatetags" folder. I called mine "calculate_age.py" and then in your template "{% load calculate_age %}" then use it, "{{ object.birthdate|age }}"</p>
Freely redistributable