On 1/5/07, John DeRosa <[EMAIL PROTECTED]> wrote:
What's the proper/recommended/improper/not-recommended use of models.LazyDate() in 0.95? I'm working on a project that picked up its use in 0.91-based code. There's a passing reference to it in the 0.90 docs, but nothing since then. There are references to it all over the web... E.g.: class UserReadComment(models.Model): scoop = models.ForeignKey(Scoop,raw_id_admin=True) [...snip...] last_read = models.DateTimeField(default=models.LazyDate(), auto_now=True)
The purpose of LazyDate is to be a proxy around a date object that allows you to specify a date that won't be evaluated until it is used in a model. In your example, comment.last_read.day will return the day on which the instance was saved (similarly for other attributes of the date object). You can also provide arguments to the LazyDate that specify a timeDelta to apply; for example: limit_choices_to = {'date__gt' : models.LazyDate(days=-3)} would be a filter that keeps only those objects from the last three days. There is a tangential reference to LazyDate in the model API documentation, but otherwise, this is an area where some documentation could be useful. I've opened a ticket (#3231) for this issue. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---