Skip to main content

This project was originally a fork of https://github.com/tutorcruncher/django-bootstrap3-datetimepicker : The js/css files are now included again into the project

This package uses Bootstrap v3 datetimepicker widget version 2 provided by the following project:

https://github.com/Eonasdan/bootstrap-datetimepicker

The correct formatting options for dates can be found here:

http://momentjs.com/docs/

It works only with Bootstrap3.

Install

  • Run pip install django2-bootstrap3-datetimepicker

  • Add 'bootstrap3_datetime' to your INSTALLED_APPS

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>
        <link rel="stylesheet"
              href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.css">
        <link rel="stylesheet"
              href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.css">
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.js">
        </script>
        <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.js">
        </script>
        {{ form.media }}
    </head>
    <body>
        <form method="post" role="form">
            {% for field in form.visible_fields %}
            <div id="div_{{ field.html_name }}"
                 class="form-group{% if field.errors %} has-error{% endif %}">
                {{ field.label_tag }}
                {{ field }}
                <div class="text-muted pull-right">
                    <small>{{ field.help_text }}</small>
                </div>
                <div class="help-block">
                    {{ field.errors }}
                </div>
            </div>
            {% endfor %}
            {% for hidden in form.hidden_fields %}
                {{ hidden }}
            {% endfor %}
            {% csrf_token %}
            <div class="form-group">
                <input type="submit" value="Submit" class="btn btn-primary" />
            </div>
        </form>
    </body>
</html>

Bootstrap3 and jQuery have to be included along with {{ form.media }}

Requirements

  • Python >= 3.4

  • Django >= 2.0

  • Bootstrap == 3.X

  • Moment >= 2.10.6

  • bootstrap-datetimepicker >= 4.15.35

Metadata

Release files for django2-bootstrap3-datetimepicker 3.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django2-bootstrap3-datetimepicker 3.0.3
File Size Uploaded Provenance Actions
django2-bootstrap3-datetimepicker-3.0.3.tar.gz 70.9 kB Without provenance Details for django2-bootstrap3-datetimepicker-3.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django2-bootstrap3-datetimepicker 3.0.3
File Interpreter ABI Platform Actions
django2_bootstrap3_datetimepicker-3.0.3-py3-none-any.whl Python 3 none any Details for django2_bootstrap3_datetimepicker-3.0.3-py3-none-any.whl

Total release size: 195.8 kB

Release files / django2-bootstrap3-datetimepicker-3.0.3.tar.gz

Download URL django2-bootstrap3-datetimepicker-3.0.3.tar.gz
Size 70.9 kB
Tags Source
SHA-256 checksum
How to use checksums
125a515a630af2f3ae52127fd2dea729df63ce7d0beb4df8ae1623aa9566ab1a
BLAKE2b-256 checksum
How to use checksums
dc848ff4238546b684e5c7eea7db1f1ee614b4a825b3815d8b02521edc6dd536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.8

Release files / django2_bootstrap3_datetimepicker-3.0.3-py3-none-any.whl

Download URL django2_bootstrap3_datetimepicker-3.0.3-py3-none-any.whl
Size 124.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b262ef6e8ea57ad5dcf8967820c94610bfc73f8e2bc8c816c62384762e8574c
BLAKE2b-256 checksum
How to use checksums
01c79eba486defc9cca100743f4762be561db2cae68501ceb639a827ac42e989
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.6.8

Security for django2-bootstrap3-datetimepicker 3.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page