django-bootstrap-datepicker
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
Metadata
Release files for django-bootstrap-datepicker-widget 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-bootstrap-datepicker-widget-0.1.tar.gz | 3.8 kB | Details |
Release files / django-bootstrap-datepicker-widget-0.1.tar.gz
| Download URL | django-bootstrap-datepicker-widget-0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c13c7e9911a142e8bb08f970199b66870498eebfb87bf17f468d115faa29c654
|
|
BLAKE2b-256 checksum How to use checksums |
f1d03c3cde29c039b0a1ed7bfa6b2b39dc28a7d1eaa6fe7509d57c28be57263c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |