Re: Inserting a date into DateField

2008-01-13 Thread Branton Davis
Well, there is, but you really ought to validate somehow. Like shabda says, django is expecting a python datetime object. You can create one with your string by first grabbing the individual bits and then using the datetime function to create one. from datetime import datetime year, month, day

Re: Inserting a date into DateField

2008-01-12 Thread Darthmahon
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

Re: Inserting a date into DateField

2008-01-12 Thread shabda
_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 dependin

Re: Inserting a date into DateField

2008-01-12 Thread l5x
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:

Inserting a date into DateField

2008-01-12 Thread Darthmahon
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 w