Using the fancy date/time widget with newforms

213 views
Skip to first unread message

Dave

unread,
Oct 9, 2007, 3:24:46 PM10/9/07
to Django users
Hey All,

Is there a simple way to re-create the fancy admin date/time widget
(with the 'Today'/'Now' buttons and the pop-up calendar) with
newforms?
I can see how to do it by creating a custom widget, but I thought
perhaps there was an easier way.

Thoughts?

Russell Keith-Magee

unread,
Oct 9, 2007, 7:38:51 PM10/9/07
to django...@googlegroups.com

A custom widget would be the correct approach. In fact, the widget has
already been written - it is in the newforms-admin branch in
django.contrib.admin.widgets as AdminDateWidget and AdminTimeWidget.

These admin widgets won't be directly usable in a trunk-based project
- they make use of Media defintions, which have been added in the
newforms-admin branch. However, you should be able to use them to give
you ideas on how a custom date widget should be written.

Yours,
Russ Magee %-)

Ben Ford

unread,
Oct 9, 2007, 10:08:41 PM10/9/07
to django...@googlegroups.com
Hi Dave,
I believe this is what you're looking for http://www.djangosnippets.org/snippets/391/ I had to tweek a few things to get it to work, but it looks pretty damn good now! If it's what you want let me know if you have any issues setting it up and I'll do my best to help ;-)
Ben
--
Regards,
Ben Ford
ben.f...@gmail.com
+6281317958862
Reply all
Reply to author
Forward
0 new messages