Wednesday, August 25, 2010

extend TimeFormat

hello,

i've a problem extending the TimeFormat class (used by "time" template
filter).

basically, i need a new method:

def F(self):
if self.date.minute == 0:
return self.G()
return u'%s:%s' % (self.G(), self.i())

very similar to the original one except for a G() instead of a g().

the (too) easy path is to modify the dateformat.py, but i don't want
to modify the django installation for many obvious reasons.

i want to extend the dateformat class, and i tryed to put this

---------------------------------
from django.utils.dateformat import TimeFormat

class TimeFormat(TimeFormat):
"extends with one method"

def F(self):
if self.date.minute == 0:
return self.G()
return u'%s:%s' % (self.G(), self.i())
-----------------------------------

in many places inside my project tree (settings.py, views.py, __init__.py )
but in vain.

where should i put it?


regards,
marco.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate