DateTime Picker to Django using Bootstrap Twitter and bootstrap-datetimepicker
JavaScript Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
django_bootstrap_datetimepicker
.gitignore
MANIFEST.in
README.md
setup.py

README.md

django-bootstrap-datetimepicker

DateTime Picker to Django using Bootstrap Twitter and bootstrap-datetimepicker

This package uses Bootstrap v2.x datetimepicker widget provided by the following project: http://tarruda.github.com/bootstrap-datetimepicker/

It works only with Bootstrap2.x. If you are using Bootstrap3 in your Django project, visit https://github.com/nkunihiko/django-bootstrap3-datetimepicker/

Install

  • Run pip install django-bootstrap-datetimepicker
  • Add 'django_bootstrap_datetimepicker' to your INSTALLED_APPS

Example

forms.py
from django import forms
from django_bootstrap_datetimepicker.widgets import BootstrapDateTimeInput

class ToDoForm(forms.Form):
    todo = forms.CharField()
    date = forms.DateTimeField(
        widget=BootstrapDateTimeInput()
    )
    reminder = forms.DateTimeField(
        widget=BootstrapDateTimeInput()
    )
template.html
<!DOCTYPE HTML>
<html>
  <head>
    <link
        href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap.min.css"
        rel="stylesheet">
    {{ form.media.css }}
  </head>
  <body>
    {{ form }}
    <script type="text/javascript"
     src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js">
    </script> 
    <script type="text/javascript"
     src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js">
    </script>
    {{ form.media.js }}
  </body>
<html>