On Fri, 2007-04-20 at 09:09 +0000, Henrik Lied wrote:
> Hi there,
> 
> I'm creating a user registration system for a project.
> The system uses the SelectDateWidget for user input of birthdate.
> 
> When I try to register a new user, the system spits back this error:
> 'str' object has no attribute 'strftime'
> 
> This is the relevant code:
> bd_month = frm.data['birthdate_month']
> bd_day = frm.data['birthdate_day']
> if len(bd_month) == 1:
>     bd_month = '0'+bd_month
> if len(bd_day) == 1:
>     bd_day = '0'+bd_day
> 
> temp_date = frm.data['birthdate_year']+'-'+bd_month+'-'+bd_day
> 
> The error occurs in django/db/models/fields/__init__.py in
> get_db_prep_save

A few more clues might be helpful. The error message is telling you that
you're passing a string where a datetime object is expected, but you
don't explain how you are passing data to a model field anywhere. Note
that get_db_prep_save() is used to convert Python objects back to
strings for putting into the database, so if your field data has not
been already converted to a Python object by that point, a mistake has
been made somewhere.

What line in the above code fragment throughs the exception? If none of
those lines do it, how are you passing your data to the code that does
throw the exception? Can you write a short example that shows the
problem?

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to