Skip to main content

Bootstrap3 compatible datetimepicker for Django 1.11 projects.

Project description

This package uses Bootstrap v3 datetimepicker widget version 4.

This project was originally a fork of tutorcruncher/django-bootstrap3-datetimepicker, it now has the following breaking changes:

  • Modified to work properly with Django 1.11 (didn’t take into account previous versions)

  • 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

pip install django-bootstrap3-datetimepicker-3

Example

forms.py

from bootstrap3_datetime.widgets import DateTimePicker
from django import forms

  class ToDoForm(forms.Form):
      todo = forms.CharField(
          widget=forms.TextInput(attrs={"class": "form-control"}))
      date = forms.DateField(
          widget=DateTimePicker(options={"format": "YYYY-MM-DD"}))
      reminder = forms.DateTimeField(
          required=False,
          widget=DateTimePicker(options={"format": "YYYY-MM-DD HH:mm"}))

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

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.11

  • Bootstrap == 3.X

  • Moment >= 2.10.6

  • bootstrap-datetimepicker >= 4.15.35

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

File details

Details for the file django-bootstrap3-datetimepicker-3-2.6.0.tar.gz.

File metadata

File hashes

Hashes for django-bootstrap3-datetimepicker-3-2.6.0.tar.gz
Algorithm Hash digest
SHA256 21a63d2c89b9ed290a1dea3aa18e4422cc523f9540d149918a8bd74db5825503
MD5 f0f7b7b6f66869f3f60315c870089df8
BLAKE2b-256 2d8c9e0576ec64942608ac955bd3078b66cf5ce6a88c38cf7581b368edd6e267

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page