datepicker

已查看 20 次
跳至第一个未读帖子

sum abiut

未读,
2015年5月26日 13:31:242015/5/26
收件人 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

未读,
2015年5月26日 13:40:562015/5/26
收件人 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

未读,
2015年5月26日 13:50:162015/5/26
收件人 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

未读,
2015年5月27日 03:40:322015/5/27
收件人 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
回复全部
回复作者
转发
0 个新帖子