Re: Customization datepicker

304 views
Skip to first unread message

parsch

unread,
Feb 13, 2013, 2:02:33 PM2/13/13
to django-g...@googlegroups.com
You can add a custom datepicker-js by using a Media inner class on your ModelAdmin (see https://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-media-definitions).

I've attached a grappelli_custom_datepicker_template.js — you just have to define your custom options in that file.

Best, Axel



Am Mittwoch, 13. Februar 2013 17:03:23 UTC+1 schrieb Paul Stadnikov:
can i customize datepicker to my locale (russian) and how it doing?
grappelli_custom_datepicker_template.js
Message has been deleted

Paul Stadnikov

unread,
Feb 14, 2013, 6:56:58 AM2/14/13
to django-g...@googlegroups.com
thanks

Mark Bird

unread,
May 21, 2018, 11:31:42 AM5/21/18
to Django Grappelli
I know this is 5 years old, but I found this post via Google and used it to configure a custom datepicker successfully on the current version of Grappelli, with one issue, that it didn't work on newly created inlines. Just figured out why so I thought I'd post the solution here - as well as overriding the grappelli.initDateAndTimePicker function you *also* have to override the grappelli.reinitDateTimeFields function, passing in the same options you defined in grappelli.initDateAndTimePicker (for obvious reasons it's probably better to declare the options object outside both functions so you can just use the same options object in each). Hope that helps someone!
Reply all
Reply to author
Forward
0 new messages