Django从日历中选择多个日期 [英] Django select multiple date from calendar

查看:130
本文介绍了Django从日历中选择多个日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用Django的新手,我想知道是否可以通过某种方式从日历中选择多个日期,

Im new in using Django, and i want to know if there is some way to have a multiple date selection from a calendar,

我有很多天:

例如一天是:

[2009年7月28日8:30-7月28日17h 00

[ 28 july 2009 8:30 - 28 july 17h00 ]

有什么办法可以使用Django Forms

Is there any way to do this with Django Forms

非常感谢

kimo

推荐答案

我不认为这是开箱即用的,但是应该可以通过自定义窗口小部件和某些关联的媒体来实现.请参见 datetime小部件 datetime小部件其关联媒体用于当前的实现.您应该能够以该解决方案为基础.通过将两个日期合并到一个窗口小部件/字段中,您可以创建一个日期范围.另请参见 MultiValueField 和分别分别其小部件.

I don't believe this is supported out of the box, but should be doable through a custom widget and some associated media. See the source for the datetime widget and its associated media for the current implementation. You should be able to base your solution off that one. By combining two dates into a single widget/field, you can create a date range. Also see the source for the MultiValueField and its widget, respectively.

这篇关于Django从日历中选择多个日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆