GithubHelp home page GithubHelp logo

django-bootstrap3-datetimepicker's People

Contributors

bouttier avatar gcaprio avatar imposeren avatar lvella avatar nkunihiko avatar robberphex avatar scardine avatar scotteadams avatar vaal- avatar vivekfantain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-bootstrap3-datetimepicker's Issues

Unable to clear value

Hello,

After selecting a date, I can't clear the value, the date still remains.

date_from = forms.DateField(
    required=False,
    widget=DateTimePicker(options={'format': 'DD/MM/YYYY',
                                   'pickTime': False}))

I'm using django-bootstrap3.

INSTALLED_APPS signature

The README says to add 'bootstrap3_datetime' to INSTALLED_APPS, but I had to use 'bootstrap3_datetime'.

I figure this is a typo somewhere, and that I'd report it!

Cannot select dates before 1970.

Using the current bootstrap3-datetimepicker, I cannot select dates before 1970.

see similar issue with angular package.

screen shot 2016-03-03 at 8 28 46

It appears newer versions of the bootstrap3-datetimepicker library fix this. I noticed a few pull-requests to integrate newer versions of the bootstrap3-datetimepicker in this package. Are there plans to integrate updated versions?

Version tags

Currently this repository doesn't appear to have any tags for versions.

Can you please tag the versions so they can be referenced externally?

Django 1.11 support

Nice package, but it look outdated,

I've got the problems when run on actual Django 1.11

Bootstrap v3.3.6

  1. Build_attrs in widget.py raise a python error. #67 pull is helping, but
  2. Javascript libs look outdated, buttons is frozen and (index):34 Uncaught TypeError: jQuery(...).datetimepicker is not a function is in browser console

Could you suggest a actual working fork?

required marker not shown

The following field:

forms.DateField(required=True, widget=DateTimePicker())

...when rendered, does not have the star indicating required next to its label. If I don't use the DateTimePicker, the star is correctly rendered.

Bringing in media assets in the wrong order

DateTimePicker defines Media.js to bring in the css and javascript, but doesn't include moment.

So I tried to derive off of DateTimePicker and add moment -- but Django emits media resource inclusions in the order of base class up.

I monkeypatched:

DateTimePicker.Media.js = ['moment/moment.js',] + [js for js in DateTimePicker.Media.js]

Which worked. But if this encapsulation is not including Moment, but is including the datetimepicker js/css, there needs to be a way to also define moment as a requirement.

Or leave it all up to the user of the class.

Undefined is not a function error

this is my forms.py

from bootstrap3_datetime.widgets import DateTimePicker  
from django import forms

class serviceForm(forms.ModelForm):

    serviceRequestDate = forms.DateTimeField(
        widget=DateTimePicker(options={"format": "YYYY-MM-DD",
                                       "pickTime": False}))

    class Meta:
        model = serviceBooking
        fields = ('serviceRequestDate', 'serviceRequestTime', 'serviceDetails')

this is my template;

<form method="post" action="/services/book/">{% csrf_token %}
                                <div class="col-xs-12 col-sm-6">
                                    <div class="form-group required">
                                        <label for="InputName">Date <sup>*</sup> </label>
                                        {{form.serviceRequestDate}}
                                    </div>
                                    <div class="form-group required">
                                        <label for="InputLastName">Number of Hours <sup>*</sup> </label>
                                        {{form.serviceRequestTime}}
                                    </div>

                                </div>
                                <div class="col-xs-12 col-sm-6">
                                    <div class="form-group required">
                                        <label for="InputZip">Tell us about your work? <sup>*</sup></label>
                                        {{form.serviceDetails}}
                                    </div>


                                </div>
</form>

I have included the {{form.media}} tag in my head but I'm getting undefined is not a function error in my console and the datepicker is not opening.

<script>
            $(function() {
                $("#id_serviceRequestDate_picker").datetimepicker({"pickTime": false, "language": "en-us", "format": "YYYY-MM-DD"});
            });
</script>

Disabled dates range?

Is there a way to cleanly disable sets of dates? For example, I'm trying to disable all dates greater than today. The JS docs say to call moment, but since widget attrs are passed in as strings, I'm not sure how this could be accomplished:

options={"format": "YYYY-MM-DD HH:mm:ss", "disabledDates": "[moment.max()]" }

startDate not localized

startDate option only understand dates in format month/day/year.
I have system language defined as Italian, dates are shown accordingly, but startDate MUST be in US format. Is this a desired behavior?

The django.forms.util module has been renamed.

Under django 1.8 I got warning:

/usr/local/lib/python2.7/dist-packages/bootstrap3_datetime/widgets.py:2: \
RemovedInDjango19Warning: The django.forms.util module has been
renamed. Use django.forms.utils instead

Adjusting Glyphicons Position

First, let me thank you for this awesome module.

I'd like to propose making the Calendar/Clock Glyphicons on the left instead of being on the right, so when ever an validation icons - usually shown on the right - appear, they don't interfere with the icon's position.

An image describing the final output is attached.

screenshot from 2014-03-24 11 48 29

A patch that can be applied to this issue:

diff --git a/bootstrap3_datetime/widgets.py b/bootstrap3_datetime/widgets.py
index f006f80..f079b12 100644
--- a/bootstrap3_datetime/widgets.py
+++ b/bootstrap3_datetime/widgets.py
@@ -70,10 +70,10 @@ class DateTimePicker(DateTimeInput):

     html_template = '''
         <div%(div_attrs)s>
-            <input%(input_attrs)s/>
             <span class="input-group-addon">
                 <span%(icon_attrs)s></span>
             </span>
+       <input%(input_attrs)s/>
         </div>'''

     js_template = '''

startDate issue

This is quite strange.

now = timezone.localtime(timezone.now())
# US date format because DatePicker wants like this
now = now.strftime('%m/%d/%y')    

Now I define a field in a Form:

start = forms.DateTimeField(required=True,widget=DateTimePicker(options={
        'pickTime': False,
        'startDate': now
}))   

and everything goes well. But then I subclass the Form and in the subclass __init__ I want to modify the field with time picking as well (now is defined exactly as above):

self.fields['start'].widget = DateTimePicker(options={
        'pickTime': True,
        'startDate': now,
    })

Now the issue: starting date is tomorrow, the day after.
I have to force it with:

now = now - relativedelta(days = 1)

Maybe it's not a startDate issue but something related to Django?

ImportError at / No module named 'widgets'

Caused by the lack of relative import of widgets in fields.py (?)

Exception Location: /home/pkaramol/Workspace/virtualenvs/time_ds/venv_p34dj18/lib/python3.4/site-packages/bootstrap3_datepicker/fields.py in <module>, line 3

Using python 3.4.3 in the following venv

Django==1.8.11
django-bootstrap3-datepicker==0.3.1
flake8==2.5.4
mccabe==0.4.0
numexpr==2.5
numpy==1.10.4
pep8==1.7.0
pyflakes==1.0.0
requests==2.9.1
tables==3.2.2

When using relative import (.widgets) another exception occurs:

AttributeError at /
'NoneType' object has no attribute 'replace'

Exception Location: /home/pkaramol/Workspace/virtualenvs/time_ds/venv_p34dj18/lib/python3.4/site-packages/bootstrap3_datepicker/widgets.py in conv_date_format_py2js, line 58

Uncaught ReferenceError: $ is not defined

Whenever I read any tutorial on JavaScript or jQuery, this one thing was always included: Put library loading script tags at the end of the document for page load optimization, also use something like

$(document).ready(
// define datepicker activation code here
)

version variable in setup update

hi:

it seems you went from version 2.2.3 to 3.0 (according to the readme); could you update that version number in the setup?

thanks!

Unable to get datetimepicker with inlineformset?

Hello, I'm trying to get the datetimepicker to show up with an inlineformset and the fields appear on the formset along with a box where the glyph should be but the glyph is missing & nothing happens when I click within the field. I've included both bootstrap & bootstrap3_datetime in my settings.py file and have added the links to the top of my template but I'm unable to get the calender to popup. I should also mention that I utilize crispy forms as well as JQuery to dynamically create fields. Thus, I believe this may be an issue with one component blocking the other, but am uncertain where the problem lies.

Modification of the option "language" to "locale"

In the newer versions the option language has been renamed to locale, causing problems when rendering the script. I think that the only thing you have to do to solve this issue is change the key 'language' in your widgets.py for 'locale'. At line 103.
Going from this: self.options['language'] = translation.get_language()
to this: self.options['locale'] = translation.get_language()

defaultDate not showing up

I'm trying to set a default date mentioned in the options like this, but it is not showing up when displaying the form.

    start_time = forms.DateTimeField(
        required=True,
        widget=DateTimePicker(options={"format": "YYYY-MM-DD HH:mm",
                                       "defaultDate": datetime.datetime.now().strftime("%Y-%m-%d %H:%M"),
                                       }))

Am I missing something?

Project seems dead ... what fork to use instead?

No activity on Pull requests for years and no releases pushed to PyPI recently, and code is completely broken on recent versions of Django. Please comment here if you know of a fork or drop-in replacement. Thanks!

Update Datepicker v4

Will there be an update to datepicker v4? Besides, though v2.3 seems to be the stable version I does not seem to be possible to install it via pip.

updating this?

Are you updating this? If you are, I just released 2.1.30 and if you're interested, I can add some install instructions and a link to your repository.

Doesn't work with Django 1.9

The problem is this line:

from django.forms.util import flatatt

I believe flatatt was moved to django.forms.utils.

Cannot set any options

Hey, really like this project but somehow the options I set get ignored. Any idea where this is coming from?

The form:

class AddWorkTimeForm(ModelForm):
    class Meta:
        model = WorkTime
        fields = ['starting_time', 'absolute_time']
        labels = {
            'starting_time': _("Starting time (optional)"),
            'absolute_time': _("Absolute time (in minutes)")
        }
        widgets = {
            'starting_time': DateTimePicker(options={
                'format': "YYYY-MM-DD HH:mm",
                'pickSeconds': True,
                'startView': 1,
                'todayBtn': True,
                'forceParse': False,
                })
        }

template file:

{% extends "task_manager/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load task_filters %}

{% block content %}
    <div class="row">
        <div class="col-md-6 col-sm-12">
            {{ add_working_time_form.media }}
            <form class="" role="form" action="{% url "task_manager:detail" task.id %}" method="POST">
                {% csrf_token %}
                {% bootstrap_form add_working_time_form  %}
                {% buttons %}
                    <button type="submit" class="btn btn-success" />
                        {% trans "Add working time" %}
                    </button>
                {% endbuttons %}
            </form>

the produced javascript:

            $(function() {
                $("#id_starting_time_picker").datetimepicker({"pickSeconds": true, "forceParse": false, "startView": 1, "format": "YYYY-MM-DD HH:mm", "todayBtn": true, "language": "en-us"});
            });

But all I see is the default datepicker, with no pickseconds, startview being the view where I can chose the day of the month, forceParse seems to be activated, ...

Really would like to use the widget though and appreciate any help

update bootstrap-datetimepicker.js to 3.0.0

IIRC, the actual bootstrap-datetimepicker.js provided here is the version 2.1.30

seems there is a new one: v3.0.0
https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js

I noticed the v3.0.0 comes with some new method (setMinDate, etc .. see http://eonasdan.github.io/bootstrap-datetimepicker/#example3)

Do you plan to update to the newest version ?
Do you need some help to do it?

BTW, Thanks for your integration in django forms, greatly appreciated!

Integrating into crispy forms...

Hi,

I'm trying to use Bootstrap 3 Datepicker v4 (http://eonasdan.github.io/bootstrap-datetimepicker/).
Using bootstrap3/django1.9/crispy-forms

I found django-bootstrap3-datetimepicker (https://github.com/nkunihiko/django-bootstrap3-datetimepicker).

I'm just really not sure how to use this in crispy forms - would really appreciate a steer, am fairly new to django but my python is "ok".
I'm unsure if it would be better to:
(1) use the java directly in a crispy template attached through the a Field()
(2) somehow attach the widget from the second link/package in the ModelForm

My Layout is set in a ModelForm.
Form is rendered through a class based view.

Anyway, I'm not having much luck at the moment, although I got a bit sidetracked by the "other" bootstrap datetimepicker.

Thanks
:)
PS this is a double post as also asked in the crispy forms git...

TimeField is not working

If you're using a models.TimeField() and configuring the widget to something like DateTimePicker(options={"format":"HH:mm", "pickDate":False}). Should work.

It does for new objects form, but it does not work for editing an object. It tries to convert the object value to a datetime value, and obviously, that's not possible.

I think this should include some kind of check about if the value is_instance of datetime or time, to make it work in both cases.

DateTimePicker broken

Django renders the field as "#id_" but JS is looking for "#id__picker". As of Django 1.7.

Picker always sets field to current date/time, whatever is selected

Hi, I am having this issue with the picker: it displays correctly, but the first time you click on a day, the current date and time appear in the field, instead of the selected value. After this, the field value cannot be changed, no date other than the current one can ever be entered. However, the selection indicator in the picker does change based on clicks. My code in forms.py is:

    select_start_date = forms.DateTimeField(label="Select the start date and time for your request",
        required=True,
        widget=DateTimePicker(options={"format": "YYYY-MM-DD HH:mm",
                                      "pickSeconds": False})
                                       )

And in the html template file the form renders to:

   <script type="text/javascript">
    $(function () {
        $('#id_select_start_date').datetimepicker();
    });
    </script>

Thanks for any help!

French l10n does not work

Hi,

I'm a french guy too, and datetimepicker localization doesn't work for me too.

I'm using the picker without customization, and

<script type="text/javascript" src="/static/bootstrap3_datetime/js/locales/bootstrap-datetimepicker.fr.js"></script>

seams loaded, but l10n does not appear in the page, stay in english.

I've tried to copy static/bootstrap3_datetime/js/locales/bootstrap-datetimepicker.fr.js to bootstrap-datetimepicker.fr-fr.js, but same issue.

Thanks for you great work !

ImportError: No module named utils

Tests now failing with:

  File "/home/shippable/build_ve/python/2.7/src/django-bootstrap3-datetimepicker/bootstrap3_datetime/widgets.py", line 2, in <module>
    from django.forms.utils import flatatt
ImportError: No module named utils

Introduced here:

4e2fa20

Fixable with PR #35, or #34

Usage of .size() breaks code

Chrome's dev console kept throwing me a nasty error that xxxx.yyy.size()was not a function. Turns out calls to size() have been deprecated since JQuery 1.8. Replaced with .length and it worked perfectly.

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.