jckw / django-bootstrap-daterangepicker Goto Github PK
View Code? Open in Web Editor NEWThis project forked from yurimalinov/django-bootstrap3-daterangepicker
A Django form field and widget wrapper for bootstrap-daterangepicker
License: Other
This project forked from yurimalinov/django-bootstrap3-daterangepicker
A Django form field and widget wrapper for bootstrap-daterangepicker
License: Other
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.
Hey man how can I disable some date ranges in the widget?
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
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
Is this a bug ? or do I need to tune/configure something extra ?
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
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
I have a problem using this project when trying to set custom predefined ranges for daterangepicker.
I tried 2 ways:
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.
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
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
)
Seeing the following warning when running tests in my project:
RemovedInDjango40Warning: force_text() is deprecated in favor of force_str().
unicode_value = force_text(value, strings_only=True)
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!
Hi, this module does not work with newer django versions. Are you planning to update it to support newer versions? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.