Can you give me an example?
delivery_datetime = forms.SplitDateTimeField(attrs={'class':'vDateField'})
doesn't work, is that what you meant?
Thanks,
Tim.
On Sunday 29 Jun 2008, TiNo wrote:
> add:
>
> <script src="{% admin_media_prefix %}js/core.js" type="text/javascript"
>
> ></script>
>
> <script src="{% admin_media_prefix %}js/admin/Calendar.js"
> type="text/javascript" ></script>
> <script src="{% admin_media_prefix %}js/admin/DateTimeShortcuts.js"
> type="text/javascript" ></script>
>
> to your template, use SplitDateTimeField and pass the fields:
>
> attrs={'class':'vDateField'}
>
> That way you have the same date and time input as the admin interface.
>
> TiNo
>
> On Sun, Jun 29, 2008 at 10:46 PM, Tim Sawyer <list....@calidris.co.uk>
>
> wrote:
> > Hi Folks,
> >
> > What's the simplest approach for me to have a form that makes it easy for
> > the
> > user to enter a Date/Time combination?
> >
> > I have my form class specified (the field in question is a
> > forms.DateTimeField()), but I need to make it easy for users of the site
> > to enter a date/time pair for the field.
> >
> > Is there a simple way to do this? I'm using jQuery for javascript on the
> > site
> > if that's relevant.
> >
> > Thanks,
> >
> > Tim.
>
>
-------------------------------------------------------
I've got the class in the html but not the buttons for the date or time popup.
I also have two date popups and I think I should have one that has the class
vTimeField not vDateField.
collection_datetime =
forms.SplitDateTimeField(widget=forms.SplitDateTimeWidget({'class':'vDateField
required'}))
in my form is generating:
<tr><th><label for="id_collection_datetime_0">Collection
datetime:</label></th><td><input id="id_collection_datetime_0" type="text"
class="vDateField required" name="collection_datetime_0" /><input
id="id_collection_datetime_1" type="text" class="vDateField required"
name="collection_datetime_1" /></td></tr>
in my html.
Any ideas?
Cheers,
Tim.
widget=forms.SplitDateTimeWidget(
widgets=(TextInput({'class':'vDateField required'}),
TextInput({'class':'vTimeField'}))))
will work?
__init__() got an unexpected keyword argument 'widgets'
Is that because widgets isn't a parameter to __init__ ? (I'm still getting to
grips with python, it's so much more expressive than the Java I'm used to!)
My code is:
collection_datetime = forms.SplitDateTimeField(widget=
forms.SplitDateTimeWidget(widgets=
(
forms.TextInput({'class':'vDateField required'}),
forms.TextInput({'class':'vTimeField required'})
)
)
)
ta,
Tim.
> >Field required'}))
Cheers,
Tim.