On Tuesday 15 Jul 2008, Arien wrote:
> On Tue, Jul 15, 2008 at 4:57 AM, Tim Sawyer <[EMAIL PROTECTED]>
wrote:
> > In my code, I did this:
> >
> > self.datetime = pForm.cleaned_data['datetime']
> >
> > the datetime parameter passed from the form only contained the date, with
> > no time, so I assume the value in datetime then was only a date.
>
> This shouldn't happen: a DateTimeField normalizes to a
> datetime.datetime object. Are you sure you're not using a DateField
> in your form?
Well spotted.
In my form I have:
datetime =
forms.DateField(widget=forms.TextInput({'class' :
'date-pick'}),label="Available
date")
yet it's a DateTimeField in the model.
This means that the reason that the value fetched from the form is only a date
is because of the type in the form. Assigning this date only value from the
form to the model attribute means I can't use replace(hour=23) on it any
more. I don't really understand why, but I'm sure there's a logical
explanation!
Tim.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---