On Sat, Feb 21, 2009 at 7:48 AM, Chris <chriss...@gmail.com> wrote: > > Is it a good idea to reuse admin's JS datepicker widget in other apps, > and if so, what's the best way? > > I'm using django.contrib.admin.widgets.AdminDateWidget in my form, and > I've added these JS tags to my template: > > admin/DateTimeShortcuts.js > admin/RelatedObjectLookups.js > calendar.js > core.js > > This gets the datepicker icon to show up, but clicking it does > nothing. I'm assuming I probably need some CSS includes as well, but > I'm not sure which CSS files to include, or if the admin style sheets > will start to conflict with my apps style sheets. > > Regards, > Chris > > > If you use the admin datepicker in your form, instead of explicitly listign the JS to use simply put {{ form.media }} in the head of your HTML, the widget knows which JS and CSS it uses, so the form will put the<script> and <link> tags in appropriately.
Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." --Voltaire "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---