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*
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
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
> 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
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
Please, can someone tell me if I'm doing anything wrong?
Basically, the code bellow is used in a view and generates the following error:
---
text = "blah blah %s" % (object.datetimefield.strftime('%d-%m-%Y'))
---
AttributeError: 'str' object has no attribute 'strftime'
'str' ? When I go to the
6 matches
Mail list logo