Hmm ok, so there is no easy way to do this without using newforms?

On Jan 12, 12:56 pm, shabda <[EMAIL PROTECTED]> wrote:
> _dob = request.POST['dob']  gets the string representation of dob, and
> so python complains as it can't find the strftime method.
> You need to change your code to,
> _dob = form_name.cleaned_data['date_attribute_name']
> form.cleaned_data, gets you the canonical representation for the data
> type depending on the field type declared in the Form class.
> (All this assuming you are using newforms)
>
> On Jan 12, 5: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()
>
> > In my form I am writing the date like this:
>
> > 2002-01-12
>
> > Any ideas? Seems like a basic thing, but can't find a solution
> > anywhere.
>
> > Cheers,
> > Chris
--~--~---------~--~----~------------~-------~--~----~
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