Skip to main content

Bootstrap3 compatible datepicker for Django projects.

Project description

This package is a fork of django-bootstrap3-datetimepicker v2.3, available here:


Where the above uses the Bootstrap v3 datetimepicker, this package uses Bootstrap v3 datepicker widget version 1.6.1, provided by the following project:


The correct formatting options for dates can be found here:


It has only been tested with Bootstrap3.


  • Run pip install django-bootstrap3-datepicker

  • Add 'bootstrap3_datepicker' to your INSTALLED_APPS


from django import forms

from bootstrap3_datepicker.fields import DatePickerField
from bootstrap3_datepicker.widgets import DatePickerInput

class ToDoForm(forms.Form):
    # normal date field with no picker
    date_1 = forms.DateField()

    # date field with default picker, uses locale default
    # date format for display and decode
    date_2 = forms.DateField(widget=DatePickerInput())

    # date field with picker, uses specified format for display,
    # decode is via locale default input_formats so format specified
    # must match one
    date_3 = forms.DateField(widget=DatePickerInput(format="%Y-%m-%d"))

    # date field with picker, uses specified format for display and
    # input_formats for decode
    date_4 = forms.DateField(input_formats=["%B %Y"],
                             widget=DatePickerInput(format="%B %Y",
                                                    attrs={"placeholder": "Placeholder text"}))
                                                    options={"minViewMode": "months"}))

    # date picker field, uses locale default date format for display
    # and decode, same as date_2
    date_5 = DatePickerField()

    # date field with picker, uses specified format for display and
    # decode, same as date_3
    date_6 = DatePickerField(input_formats=["%Y-%m-%d"])

    # custom format with picker attrs and options specified, uses specified format
    # for display and decode, same as date_4
    date_7 = DatePickerField(input_formats=["%B %Y"],
                             widget_attrs={"placeholder": "Placeholder text"})
                             widget_options={"minViewMode": "months"})

The DatePickerInput provides the integration with the JavaScript datepicker - the options specified will be passed directly to the JavaScript datepicker. The available options are explained in the following documents:


The DatePickerField has been provided as a utility for a common usage. When the DatePickerInput is specified as a widget on a DateField and a non-standard date format is required, the format for the JavaScript datapicker and input_formats for the DateField itself should both be specified and match. On the DatePickerField the input_formats provides both the display and decode formats. The widget_attrs are passed as attributes on the widget, the widget_options are passed directly to the JavaScript datepicker.


<!DOCTYPE html>
        <link rel="stylesheet" href="//">
        <link rel="stylesheet" href="//">
        <script src="//"></script>
        <script src="//"></script>
        {{ }}
            body {
                margin: 40px auto;
                width: 90%;
            form {
                margin: 40px auto;
                min-width: 201px;
                max-width: 500px;
        <form method="post" role="form">
            {% for field in form.visible_fields %}
            <div id="div_{{ field.html_name }}"
                 class="form-group{% if field.errors %} has-error{% endif %}">
                {{ field.label_tag }}
                {{ field }}
                <div class="text-muted pull-right">
                    <small>{{ field.help_text }}</small>
                <div class="help-block">
                    {{ field.errors }}
            {% endfor %}
            {% for hidden in form.hidden_fields %}
                {{ hidden }}
            {% endfor %}
            {% csrf_token %}
            <div class="form-group">
                <input type="submit" value="Validate" class="btn btn-primary" />

Bootstrap3 and jQuery have to be included along with {{ }}.

Release Notes


  • Removed symlink in static directory and renamed 1.6.1 directory to replace it (pip doesn’t publish symlinks as expected).


  • Update to bootstrap-datepicker version 1.6.1

  • Use minified versions of the libraries (sourcemaps included)


  • Fix issue specifying attrs/options when no input_formats are specified.


  • Added support for widget attrs to DatePickerField.


  • Documentation fixes.


  • Initial release.


  • Python >= 2.7

  • Django >= 1.5

  • Bootstrap >= 3.0

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

django-bootstrap3-datepicker-0.4.1.tar.gz (51.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page