Skip to main content

Bootstrap3/4 compatible datepicker for Django projects.

Project description

This package uses Bootstrap datepicker widget version 1.6.1.

Install

pip install git+https://github.com/pbucher/django-bootstrap-datepicker.git

ToDo

General cleanup and testing

Example

forms.py

from bootstrap_datepicker.widgets import DatePicker
from django import forms

  class ToDoForm(forms.Form):
      todo = forms.CharField(
          widget=forms.TextInput(attrs={"class": "form-control"}))
      date = forms.DateField(
          widget=DatePicker(options={"format": "mm/dd/yyyy","autoclose": True}))

The options will be passed to the JavaScript datepicker instance. Available options are explained in the following documents:

Checkout the online demo to help with exploring different options:

You don’t need to set the language option, because it will be set the current language of the thread automatically.

template.html

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="{% static 'contrib/bootstrap.css' %}">
    <link rel="stylesheet" href="{% static 'contrib/font-awesome.min.css' %}">
    <script src="{% static 'contrib/bootstrap.js' %}"></script>
  </head>
  <body>
    <form method="post" role="form">
      {{ form|bootstrap }}
      {% csrf_token %}
      <div class="form-group">
        <input type="submit" value="Submit" class="btn btn-primary" />
      </div>
    </form>
  </body>
</html>

Here we assume you’re using django-bootstrap-form or django-jinja-bootstrap-form but you can draw out your HTML manually.

Requirements

  • Python >= 3.3

  • Django >= 1.8

  • Bootstrap == 4.0-alpha2

  • jquery >= 1.7.1

  • font-awesome == 4.5.X

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-bootstrap-datepicker-1.1.1.tar.gz (34.2 kB view details)

Uploaded Source

File details

Details for the file django-bootstrap-datepicker-1.1.1.tar.gz.

File metadata

File hashes

Hashes for django-bootstrap-datepicker-1.1.1.tar.gz
Algorithm Hash digest
SHA256 645c17560fef87a730f16987ec7fc3f887580ff0a5086a8e9218a49b7623541c
MD5 b71dce9e8845101690ef24e7a4e2dc40
BLAKE2b-256 88960db44cd09dc395b9a2fde656ab6e5817ce7adde0fd08447ea2c7a8453049

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