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
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
_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
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:
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
5 matches
Mail list logo