On 3/29/07, Gilhad <[EMAIL PROTECTED]> wrote: > > > > > 240:00:00 (alternatively 10d 00:00:00) > > > > > > Does the timesince filter do what you require? > > > > If I understand correctly, gilhad wants to specify an interval. > > > > Possible solutions: use two PositiveIntegerFields to supply days > > and/or minutes and use them to construct a datetime.timedelta object. > > Or store a DateTimeField and construct the interval in python via > > subtracting some given date (1.1.1970 ??) from the stored value - bit > > hackish though... > > Yes, I worked at it a little and it occures to me, that what I really need are > new types of Field
are you sure property on the model is not going to do it for you? something like def get_interval( self ): return datetime.timedelta( days = self.interval_days, minutes = self.interval_minutes ) def set_interval( self, timed ): self.interval_days = timed.days ..... interval = property( get_interval, set_interval ) its not perfect, but you wouldn't have to worry about it in the code and/or hack Django... > > I will face such data more often now, so I will try to make such xxxxField by > myself and somehow incorporate it to Djando model .... If I do it well, I > will contribute it back ;-) > > Is there a way how to extend it externally, or I have to > hack /django/db/models/fields/__init__.py directly ? that said, I think this would be a nice contribution, having an IntervalField... ;) you just have to make sure it works with all the supported DB's. just let me know (here, personal email, [EMAIL PROTECTED], icq, ...) if you would like some help with that... Honza > -- > Zdravi > Gilhad > [EMAIL PROTECTED] > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---