. Dates get a "Today" shortcut and calendar popup, and times get a "Now" shortcut and a convenient popup

40 views
Skip to first unread message

anil

unread,
Sep 30, 2006, 2:18:07 AM9/30/06
to Django users
Hi guys
I m trying to get to the code of date and time widget so that I can use
it elsewhere in the django
app
Please help me out by telling where i can find this
and is there an easy way to add this to other parts of the django web
app
Thanks
Anil

Each DateTimeField gets free JavaScript shortcuts. Dates get a "Today"
shortcut and calendar popup, and times get a "Now" shortcut and a
convenient popup that lists commonly entered times.

James Bennett

unread,
Sep 30, 2006, 2:53:58 AM9/30/06
to django...@googlegroups.com
On 9/30/06, anil <ani...@yahoo.com> wrote:
> Please help me out by telling where i can find this
> and is there an easy way to add this to other parts of the django web

It's usually pretty easy to think through and figure out where to find
something, without having to wait for a mailing list reply...

The way to arrive at the answer is to start by looking at where the
admin app's code lives: the folder 'django/contrib/admin' in your
downloaded package:

http://code.djangoproject.com/browser/django/trunk/django/contrib/admin

This contains a subdirectory called 'media', which in turn contains a
subdirectory called 'js' (short for 'javascript'). Looking in there
reveals a file 'calender.js' which provides some of the logic for
creating the calendar. And there's also a subdirectory called 'admin'
which contains... DateTimeShortcuts.js:

http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/media/js/admin/DateTimeShortcuts.js

--
"May the forces of evil become confused on the way to your house."
-- George Carlin

anil

unread,
Sep 30, 2006, 5:50:35 AM9/30/06
to Django users
i was more looking for a simple way of using it
thanks a lot
Anil

James Bennett

unread,
Sep 30, 2006, 7:02:18 PM9/30/06
to django...@googlegroups.com
On 9/30/06, anil <ani...@yahoo.com> wrote:
> i was more looking for a simple way of using it
> thanks a lot

It's a JavaScript file... read through it to see what sort of HTML it
expects to work with, and tailor a page to suit.

Reply all
Reply to author
Forward
0 new messages