From 72b51a6558b78717c2fb55aba03abe2c8bbd9f72 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 11 Jan 2018 10:40:29 +0100 Subject: UI: Workon on a new date picker --- bootstrap_datepicker/README.md | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 bootstrap_datepicker/README.md (limited to 'bootstrap_datepicker/README.md') diff --git a/bootstrap_datepicker/README.md b/bootstrap_datepicker/README.md new file mode 100644 index 000000000..78ac5d97a --- /dev/null +++ b/bootstrap_datepicker/README.md @@ -0,0 +1,73 @@ +# django-bootstrap-datetimepicker + +This package includes a Django widget for displaying date pickers with Bootstrap 3 or Bootstrap 4. It uses [Bootstrap datepicker widget version 1.6.4 ](https://github.com/uxsolutions/bootstrap-datepicker). + +## Install + + pip install django-bootstrap-datepicker + +## To-Do + + General cleanup and testing + +## Example + +#### forms.py + +```python +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, and are documented and demonstrated here: + +* [Bootstrap Datepicker Documentation](https://bootstrap-datepicker.readthedocs.org/en/stable/) (ReadTheDocs.com) +* [Interactive Demo Sandbox of All Options](https://uxsolutions.github.io/bootstrap-datepicker/) + +You don't need to set the `language` option, because it will be set the current language of the thread automatically. + +#### template.html + +```html + + + + + + + + +
+ {{ form|bootstrap }} + {% csrf_token %} +
+ +
+
+ + +``` + +Here we assume you're using [django-bootstrap-form](https://github.com/tzangms/django-bootstrap-form) or +[django-jinja-bootstrap-form](https://github.com/samuelcolvin/django-jinja-bootstrap-form) but you can +draw out your HTML manually. + +## Requirements + +* Python >= 3.3 +* Django >= 1.8 +* Bootstrap == 4.0-alpha6 +* jquery >= 1.7.1 +* font-awesome >= 4.5.X -- cgit v1.2.3