List Info

Thread: Re: DateField returns 'str' object has no attribute 'strftime'




Re: DateField returns 'str' object has no attribute 'strftime'
user name
2007-04-30 15:25:49
On 30/04/07, deezthugsgmail.com <deezthugsgmail.com> wrote:
>
[...]
> Same problem:
>   AttributeError at /telecom/conference/detail/9/
>   'tuple' object has no attribute 'strftime'
> ----
> This happens on update of newform. What am I doing
wrong?
>
> view code:
> -----------------
[...]
>
conf.conference_date=form.clean_data['conference_date'],

In python if you do an assignment where the right hand side
has one or
more commas then it means you are creating a tuple:

>>> a = 1
>>> a
1
>>> a = 1,
>>> a
(1,)

So just remove the trailing commas in your view and you will
then be
assigning a date rather than a tuple to conference_date.

In general the error  "'tuple' object has no attribute
xxx" normally
means a trialling comma slipped in somewhere - it is a
mistake I have
made several times.

-- 
Phil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )