Re: Using strftime() in datetime fields

2005-11-12 Thread Eric Walstad
On Friday 11 November 2005 06:56 pm, Jeffrey E. Forcier wrote: > One trick I've found that helps in debugging is to throw out all   > assumptions, and to work backwards from a traceback while doing so. > > In your case, Python is telling you that what you *think* and what   > *really ought to be*

Re: Using strftime() in datetime fields

2005-11-11 Thread Jeffrey E. Forcier
One trick I've found that helps in debugging is to throw out all assumptions, and to work backwards from a traceback while doing so. In your case, Python is telling you that what you *think* and what *really ought to be* a DateTime object is instead a string. So, double-check--print out t

Re: Using strftime() in datetime fields

2005-11-11 Thread Eric Walstad
On Friday 11 November 2005 17:46, Pedro Furtado wrote: > > Turn it into a date, datetime or time object first, then format > > it. Like the traceback says, strings don't have strftime > > attributes/methods. > > But it already is a datetime object. Not according to the traceback you posted. -E

Re: Using strftime() in datetime fields

2005-11-11 Thread Pedro Furtado
> Turn it into a date, datetime or time object first, then format it. > Like the traceback says, strings don't have strftime > attributes/methods. But it already is a datetime object. The "object" I stated is an object of a model class, which contains a datetimefield. Am I clear now? The code ru

Re: Using strftime() in datetime fields

2005-11-11 Thread Eric Walstad
On Friday 11 November 2005 12:41, Pedro Furtado wrote: > object.datetimefield.strftime('%d-%m-%Y') [...] > AttributeError: 'str' object has no attribute 'strftime' Turn it into a date, datetime or time object first, then format it. Like the traceback says, strings don't have strftime attribute