Django: Using a custom date/time picker in forms

The Django admin form has a pretty neat date/time picker, but it's troublesome to implement for every non-admin form you've got, especially when you don't want to expose your admin files to the public.

So how do you go about splitting the date and time values so you can use your own jQuery date pickers? Easy.

class SomeForm(forms.Form):
date_posted = forms.DateTimeField(widget = forms.widgets.SplitDateTimeWidget())

And that's all!

The rest of it depends on whatever you picked for the date picker.

wekwe
Don't choose something silly...

Sources

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog