On Jan 12, 1:49 pm, Darthmahon <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to insert a simple date (2002-01-12) from a form I have
> created into a DateField but I keep getting this error:
>
> 'str' object has no attribute 'strftime'
>
> This is how the DateField is setup in my models.py file:
>
> birthday = models.DateField(blank=True)
>
> This is how I am trying to write to this field:
>
> _dob = request.POST['dob']
> user_profile =
> UserProfile(user_id=user.id,gender=_gender,birthday=_dob,living=_location)
> user_profile.save()
>

Try this:

user_profile = UserProfile(request.POST)
if user_profile.is_valid():
    user_profile.save()
else:
   ...

Best regards,
l.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to