Bootstrap 3 and 4 compatible Datepicker widget for Django.
Project description
This package is compatible with both Bootstrap 3 and 4, by giving the option to use a FontAwesome icon rather than a Glyphicon.
This package is intended to be used with bootstrap-datepicker and has been tested with v1.7.1.
This project was originally a fork of nkunihiko/django-bootstrap3-datetimepicker and hence similar to qoobic/django-bootstrap3-datepicker, but it now has the following breaking changes:
- js/css files are no longer included in the project, managing them is up to the user, eg. using grablib.
- the widget no longer has js/css assets. these are left for you to deploy as you wish.
- bug/warning fixes
- remove support for python 2.6 and associated clean up
Install
- Run pip install django-bootstrap-datepicker-widget
- Add bootstrap_datepicker to your INSTALLED_APPS
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": "YYYY-MM-DD"}, fontawesome=True))
The options will be passed to the JavaScript datetimepicker instance. Available options are explained in the bootstrap-datepicker docs
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> <!-- load all required js/css yourself here --> </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 >= 2.7
- Django >= 1.8
- Bootstrap >= 3
- FontAwesome >= 1.0 if using Bootstrap 4+
- Moment >= 2.10.6
- bootstrap-datepicker >= 1.7.1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size django-bootstrap-datepicker-widget-0.1.tar.gz (3.8 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for django-bootstrap-datepicker-widget-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c13c7e9911a142e8bb08f970199b66870498eebfb87bf17f468d115faa29c654 |
|
MD5 | 0f664ebeec63b8ea947fb5d2748d9698 |
|
BLAKE2-256 | f1d03c3cde29c039b0a1ed7bfa6b2b39dc28a7d1eaa6fe7509d57c28be57263c |