Hi,

Trying to implement a very simple template tag that will output a
company's age.  So idea being if company was established in 1860 then
it should output '148 years old' if my math is right ;-)

this is what I've got:

from django.template import *

register = Library()

@register.filter
def age(comp_age):
    d = datetime.date.today()
    b = 1860
    comp_age = int(d.year - b)
    return comp_age

No joy -  any ideas, must be pretty simple !?

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to