how to use jquery for date picker

1,763 views
Skip to first unread message

GKR

unread,
May 4, 2011, 6:45:25 AM5/4/11
to django...@googlegroups.com
how to use jquery for date picker

please help

vikalp sahni

unread,
May 4, 2011, 6:49:12 AM5/4/11
to django...@googlegroups.com
http://jqueryui.com/demos/datepicker/

Furthermore i think, this is not the right list for Jquery related queries.

Regards,
//Vikalp

On Wed, May 4, 2011 at 4:15 PM, GKR <ranag...@gmail.com> wrote:
how to use jquery for date picker

please help

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

GKR

unread,
May 4, 2011, 7:07:14 AM5/4/11
to django...@googlegroups.com
sorry for that but I am going to use that for django

thanks

vikalp sahni

unread,
May 4, 2011, 7:16:50 AM5/4/11
to django...@googlegroups.com
are you planing to use that in place of django current date time picker widget??

Which means are you looking to change the behaviour of Django Form, DateTimeField to use Jquery??

I would suggest not to change default datepickerwidget, as it works like a charm in admin forms.
You should though try implementing jquery datepicker on any other application side form Thus not changing
the default behavior of date time widget of django.

Regards,
//Vikalp

On Wed, May 4, 2011 at 4:37 PM, GKR <ranag...@gmail.com> wrote:
sorry for that but I am going to use that for django

thanks

Kenneth Gonsalves

unread,
May 4, 2011, 7:34:56 AM5/4/11
to django...@googlegroups.com
On Wed, 2011-05-04 at 04:07 -0700, GKR wrote:
> sorry for that but I am going to use that for django

if your files are in /sitemedia/ and the datefield is named
date_of_certification

<link href="/sitemedia/css/jquery-ui.css" rel="stylesheet"
type="text/css"/>
<script src="/sitemedia/js/jquery.min.js"></script>
<script src="/sitemedia/js/jquery-ui.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
$("#id_date_of_certification").datepicker({ dateFormat:
'yy-mm-dd'});
});
</script>


--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

GKR

unread,
May 4, 2011, 7:37:21 AM5/4/11
to django...@googlegroups.com
please can you help how to use that for date field.

as on adding

this to the <head> section of the page you wish to display the picker on:

  <script type="text/javascript" src="{% url jsi18n %}"></script>
  <script type="text/javascript" src="{{ ADMIN_MEDIA_PREFIX
}}/js/core.js"></script>
  <script type="text/javascript">window.__admin_media_prefix__ = "{{
ADMIN_MEDIA_PREFIX|escapejs }}";</script>
  <link href="{{ ADMIN_MEDIA_PREFIX }}/css/widgets.css"
type="text/css" media="all" rel="stylesheet" />
  {{ form.media }}

Then modify your form to use the admin date picker widget:

from django.contrib.admin.widgets import AdminDateWidget
class MyForm(forms.Form):
   some_date = forms.DateField(widget=AdminDateWidget())

--------------------------------------------------------------


i m getting errors as AdminDateWidget not defined

Kenneth Gonsalves

unread,
May 4, 2011, 8:08:41 AM5/4/11
to django...@googlegroups.com
On Wed, 2011-05-04 at 16:46 +0530, vikalp sahni wrote:
> are you planing to use that in place of django current date time
> picker
> widget??

if you had been following the thread, he wants to implement this outside
admin.

Reply all
Reply to author
Forward
0 new messages