Skip to main content

A Django form field and widget wrapper for bootstrap-daterangepicker

Project description

django-bootstrap-daterangepicker

This is Django form field wrapper for bootstrap-daterangepicker, for use with Bootstrap 3 and 4.

This module allows for: single date pickers, date range selectors and datetime range selectors.

Ranges are returned as tuples of format (start, end), where start and end are datetime.date or datetime.datetime objects depending on the field type.

The DateField is a replacement for Django's built-in forms.DateField, with the only difference being that it accepts an optional clearable parameter, and the default widget is the DatePickerWidget specified in this module.

Origin

This is unofficial package. No changes except issue#23.

Installation

  1. pip install django-bootstrap-daterangepicker
  2. Add 'bootstrap_daterangepicker' to your INSTALLED_APPS
  3. Add the resource links required for bootstrap-daterangepicker into the <head> of the relevant HTML files

Example usage

from django import forms
from bootstrap_daterangepicker import widgets, fields


class DemoForm(forms.Form):
    # Date Picker Fields
    date_single_normal = fields.DateField()
    date_single_with_format = fields.DateField(
        input_formats=['%d/%m/%Y'],
        widget=widgets.DatePickerWidget(
            format='%d/%m/%Y'
        )
    )
    date_single_clearable = fields.DateField(required=False)

    # Date Range Fields
    date_range_normal = fields.DateRangeField()
    date_range_with_format = fields.DateRangeField(
        input_formats=['%d/%m/%Y'],
        widget=widgets.DateRangeWidget(
            format='%d/%m/%Y'
        )
    )
    date_range_clearable = fields.DateRangeField(required=False)

    # DateTime Range Fields
    datetime_range_normal = fields.DateTimeRangeField()
    datetime_range_with_format = fields.DateTimeRangeField(
        input_formats=['%d/%m/%Y (%I:%M:%S)'],
        widget=widgets.DateTimeRangeWidget(
            format='%d/%m/%Y (%I:%M:%S)'
        )
    )
    datetime_range_clearable = fields.DateTimeRangeField(required=False)

Requirements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django4-bootstrap-daterangepicker-1.0.7.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django4_bootstrap_daterangepicker-1.0.7-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django4-bootstrap-daterangepicker-1.0.7.tar.gz.

File metadata

File hashes

Hashes for django4-bootstrap-daterangepicker-1.0.7.tar.gz
Algorithm Hash digest
SHA256 74fdb02e877d818a0a220bd510ce09185fc229d6f578828558f102c6cd1b8682
MD5 605512bc1ce1868c313bb9947f1d3938
BLAKE2b-256 23e6bdf2dcd9effbc384a1f39a5b4d6d12eca70521ddd6bdb2059aedcdd95653

See more details on using hashes here.

File details

Details for the file django4_bootstrap_daterangepicker-1.0.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django4_bootstrap_daterangepicker-1.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 59e0b3c556165d63cf9ecd9569285feb459be4b18ac662d0700da2ace8a9d274
MD5 58e63a9b03040876cb2e42aa4f1a6b00
BLAKE2b-256 c6fcfdd0b10e173e77095233d5e6b5fdc06b3932d2b0d3b2dc387fda9c2c5fe9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page