Giter Club home page Giter Club logo

django-bootstrap-daterangepicker's People

Contributors

dfrank-a avatar intiocean avatar jackatomenapps avatar jckw avatar yurimalinov avatar

Stargazers

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

Watchers

 avatar  avatar

django-bootstrap-daterangepicker's Issues

Update pypi.org version

Hi,

It's possible to update pypi version to 1.0.6?

I'm using Django 3 and have a error on importing six.

Ty

pypandoc in setup.py breaks pip install

Hello,
Using pypandoc in setup.py makes pandoc a system requirement so it can't be pip installed if you don't have pandoc. Before the last change it was working since pandoc only was called when uploading the package. Is it possible to revert to that behavior?

Thanks.

cannot import name gettext_lazy

Since the fix to #6 was put in, gettext_lazy doesn't work, as it should be imported from django.utils.text (as it was before).

File "bootstrap_daterangepicker/fields.py", line 7, in
from django.utils.text import format_lazy, gettext_lazy as _
ImportError: cannot import name gettext_lazy

Single date picker should be possible

To improve simplicity, a DatePickerField and DatePickerWidget should be created that automatically uses the defaults for a single date picker, as specified in the Date Range Picker examples. A higher abstraction makes the module easier to use.

Problems with DOMContentLoaded event

With changing
$(function() {...}) (version 1.0.1)
to
window.addEventListener("DOMContentLoaded", function() {...}) (version 1.0.4)
in
templates\bootstrap_daterangepicker\daterangepicker.html
the widget will not be displayed anymore.

Since I have little experience with Javascript: is this a problem with my code?
I'm using the widget in a bootstrap modal dialog as shown here:
https://www.abidibo.net/blog/2015/11/18/modal-django-forms-bootstrap-4/

Thanks in advance!

Impossible to set custom ranges to be evaluated on page load

I have a problem using this project when trying to set custom predefined ranges for daterangepicker.

I tried 2 ways:

  1. Define picker options in python, use datetime objects and convert them to strings.
    The problem here is that datetime objects are evaluated at server start and never change. And there is no way to pass javascript code from python, as you can only pass json objects.
  2. Create subclasses for each Field/Widget provided by this module to redefine used template, include original template and then set ranges for already initialized daterangepicker object. The problem is that unlike with other fields, it is impossible to set ranges to daterangepicker after initialization - they are just not shown.

DateRange issue in initial widget content

Hi,

I am using the daterangepicker in my admin by setting simply in my ModelAdmin the following

    formfield_overrides = {
        DateRangeField: {'form_class': fields.DateRangeField},
    }

It works well for editing and saving this field as shown here below
image

However, when initially loading the change form with already a value for the DateRangeField, it starts with the string representation of the DateRange instead of the format "yyyy-mm-dd - yyyy-mm-dd" as shown here below
image

Is this a bug ? or do I need to tune/configure something extra ?

Time formatting

This seems too small for a pull request, but I'll supply one if you'd like.

widgets.py, lines 23 and 24 should be changed from

    '%H': 'hh',
    '%I': 'h',

to

    '%H': 'HH',
    '%I': 'hh',

Both %H and HH represent zero-padded 24-hour hours, so one should be equivalent to the other. h represents non-padded 12-hour hours, and is probably not useful with this widget. %I and hh are both zero-padded 12-hour hours, and should be considered equivalent as well.

If "picker_options={'timePicker24Hour': True,}" is passed to the DateTimepicker, and %H is used in the format string, the widget popup will display 24-hour hours, but will send 12-hour hours to the CharField in the form. For instance, the user can actually select 1930 or 2300 as valid times in the popup, but 0730 and 1100 will result in the text of the CharField.

Additionally, the default example on the Readme, which uses 12-hour hours, should probably use '%I', rather than '%H'

References:
http://strftime.org
https://devhints.io/moment

Disable ranges

Hey man how can I disable some date ranges in the widget?

Making a clearable form is too difficult

At a minimum, 'locale' must be specified in picker_options, which removes the date format set in the widget's format parameter.

Additional javascript must also be used to allow the input to be cleared.

This requires a lot of checking the docs for the JavaScript Bootstrap Date Range Picker, for a fairly standard feature that could have the basic setup shortened by passing clearable=True as an argument.

Example of the unnecessary complexity:

class SomeForm(forms.Form):
    date_format = '%d/%m/%Y'

    search_date_range = DateRangeField(
        input_formats=[date_format],
        widget=DateRangeWidget(
            format=date_format,
            picker_options={
                'locale': {
                    'cancelLabel': 'Any date',
                    'autoUpdateInput': False,
                    'format': 'DD/MM/YYYY',
                }
            }),
        required=False
    )

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.