On Tue, Jul 15, 2008 at 7:25 AM, Tim Sawyer <[EMAIL PROTECTED]> wrote:
> 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.

Why not use a DateTimeField in your form and change the widget
instead?  For example:

  datetime = forms.DateTimeField(
      widget=forms.DateTimeInput(format='%Y-%m-%d', attrs={'class' :
'date-pick'}),
      label="Available date"
  )

(Note the attrs={...} for the class.)

> 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!

The logical explanation is that adjusting the hour of a date doesn't
make sense, because a date doesn't have any hour.  ;-)


Arien

--~--~---------~--~----~------------~-------~--~----~
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