On 25.10.2008 16:42 Uhr, Low Kian Seong wrote: > Dear all, > > I am using generic views to create my forms without using the admin interface. > > When I try to recreate the form in my template using the form function: > > {{ form.as_p }} > > Everything is okay except that my date fields have no datepicker. My > question is there a way to re-create the admin interface datepicker > for datefields which still allows me the convenience of using the > 'as_p' function and list down all the fields individually in my > template. > > This is all untested and only from looking at the admin html output, but it should put you in the right direction
include the date-picker Javascripts from the admin in your template and then: <script type="text/javascript" src="<ADMIN_MEDIA_PREFIX>/js/calendar.js"></script> <script type="text/javascript" src="<ADMIN_MEDIA_PREFIX>/js/admin/DateTimeShortcuts.js"></script> and the date input a class of vDateField. <input name="pub_date_0" value="2008-10-09" class="vDateField" type="text" id="id_pub_date_0" size="10" /> replace ADMIN_MEDIA_PREFIX with whatever url is needed to get to your admin media files or add the setting ADMIN_MEDIA_PREFIX to the template context. adi -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer web: http://www.sieker.info/profile SAP-Developer --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---