And here is the tag from django.core.template import Library, Node,resolve_variable from django.core import template import datetime register = Library()
class TimedifNode(Node): def __init__(self, EndTime): self.EndTime = EndTime def render(self, context): Difference=resolve_variable(self.EndTime, context)-datetime.datetime.now() if resolve_variable(self.EndTime, context)>datetime.datetime.now(): context['EndInDays']=Difference.days context['EndInHours']=(Difference.seconds/3600)%60 HodPom=(float(Difference.seconds)/3600)%60 Hod=int(HodPom) context['EndInMinutes']=int((HodPom-Hod)*60) context['AuctionFinished']=0 else: context['AuctionFinished']=1 context['EndInDays']='' context['EndInHours']='' context['EndInMinutes']='' return "" def Timedif(parser, token): bits = token.contents.split() if len(bits) != 2: raise template.TemplateSyntaxError, 'Timedif tag takes exactly one argument' return TimedifNode(bits[1]) Timedif = register.tag(Timedif) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---