Giter Site home page Giter Site logo

django-bootstrap3-datetimepicker-3's Introduction

django-bootstrap3-datetimepicker

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

django-bootstrap3-datetimepicker-3's People

Contributors

saschasommer avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.