datepicker

20 views
Skip to first unread message

sum abiut

unread,
May 26, 2015, 1:31:24 PM5/26/15
to django...@googlegroups.com
Hi,
Is there a way to implement jquery datepicker with Django models. I am looking at http://jqueryui.com/datepicker/ but i am finding very difficult to apply it to django models. any help will be very much appreciated.

Cheers


Peith Vergil

unread,
May 26, 2015, 1:40:56 PM5/26/15
to django...@googlegroups.com

I don't think you do it with models. You do it with form fields. An easy way is to simply create a regular CharField, render it like usual. Then, on the front-end, you simply target that specific char field and initialize the datepicker on it.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y735T-8%3DNVdePFU7UEmN_9SQmsLj9uWUeCQ%2B-dRUMNYjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Peith Vergil

unread,
May 26, 2015, 1:50:16 PM5/26/15
to django...@googlegroups.com

Actually, use the DateField instead of the CharField so you get server side validation of the date input. It should just render as a text input on the front-end.

aRkadeFR

unread,
May 27, 2015, 3:40:32 AM5/27/15
to django...@googlegroups.com
Hey,

Look at the widgets in the fields forms:
https://docs.djangoproject.com/en/1.8/ref/forms/widgets/

Implement your own widget, so it includes the javascript
and the css your datepicker needs.

Then render it in your template (the medias included).

Have a good one
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y735T-8%3DNVdePFU7UEmN_9SQmsLj9uWUeCQ%2B-dRUMNYjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
aRkadeFR
Reply all
Reply to author
Forward
0 new messages