A minimum working example (MWE) for a Django 2.0+ date/time range picker for use with the Cville Pride events project (currently closed-source).
This project is licensed under the BSD 2-clause "Simplified" License, wherever it is possible to do so.
Refer to LICENSE for more.
TimeRangedModelForm
, aModelForm
subclass that combines two separate model fields (time_start
andtime_end
) into a single form field,time_range
, for easier front-end display.DateTimeRangeField
, aMultiValueWidget
subclass that represents the start and end of a range of date/times.DateTimeRangeWidget
, aTextInput
suclass that provides an interface between the interactive Date Range Picker front-end and theDateTimeRangeField
class.- A very simple app that uses the
TimeRangedModelForm
to create newEvent
model instances.
Pre-requisites for this project can be found in requirements.txt.
This MWE relies on Date Range Picker for the
front-end display of date ranges. Date Range Picker itself uses
Bootstrap and Moment.js.
These libraries are included in the DateTimeRangeWidget
's Media
meta class,
which can be loaded in templates via {{ form.media }}
.