Django从日历中选择多个日期

时间:2022-08-25 19:26:09

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

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

i have multiple days :

我有多天:

for example a day is :

例如,一天是:

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

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

Is there any way to do this with Django Forms

有没有办法用Django Forms做到这一点

Thanks a lot

非常感谢

kimo

1 个解决方案

#1


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.

我不相信这是开箱即用的,但应该可以通过自定义小部件和一些相关媒体来实现。查看当前实现的datetime小部件及其关联媒体的源代码。您应该能够将解决方案基于该解决方案。通过将两个日期组合到一个窗口小部件/字段中,您可以创建日期范围。另请参阅MultiValueField的源代码及其小部件。

#1


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.

我不相信这是开箱即用的,但应该可以通过自定义小部件和一些相关媒体来实现。查看当前实现的datetime小部件及其关联媒体的源代码。您应该能够将解决方案基于该解决方案。通过将两个日期组合到一个窗口小部件/字段中,您可以创建日期范围。另请参阅MultiValueField的源代码及其小部件。