Giter Site home page Giter Site logo

monim67 / django-flatpickr Goto Github PK

View Code? Open in Web Editor NEW
57.0 57.0 11.0 228 KB

Flatpicker based DatePickerInput, TimePickerInput and DateTimePickerInput with date-range-picker functionality for django >= 2.0

Home Page: https://pypi.org/project/django-flatpickr/

License: MIT License

Python 67.06% JavaScript 13.19% HTML 19.61% Dockerfile 0.14%
date-picker daterangepicker datetimepicker django flatpickr timepicker

django-flatpickr's People

Contributors

dependabot[bot] avatar monim67 avatar rymdhund 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

Watchers

 avatar  avatar  avatar  avatar

django-flatpickr's Issues

Does not works in Bootstrap modal

Hi @monim67
Thanks for this module!
I faced with issue that it does not works in the Bootstrap modal as initialization JS waiting for DOMContentLoaded event, but modal does not fires this event.

django-flatpickr.js:53

  document.addEventListener('DOMContentLoaded', function (event) {
    findAndProcessFlatpickrInputs(document);
    document.addEventListener('DOMNodeInserted', function (event) {
      setTimeout(() => {
        if (event.target.querySelectorAll) findAndProcessFlatpickrInputs(event.target);
      });
    });
  });

Modifying django-flatpickr.js:53 this way - everything becamoe work correctly, I created another copy of this file to use in modals, would be cool to find solution for both cases (DOMContentLoaded and shown.bs.modal) but I have no ideas right now.

document.addEventListener('shown.bs.modal', function (event) {
    findAndProcessFlatpickrInputs(document);
    document.addEventListener('DOMNodeInserted', function (event) {
      setTimeout(() => {
        if (event.target.querySelectorAll) findAndProcessFlatpickrInputs(event.target);
      });
    });
  });

Static file doesnot load from CDN

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
1- setup the package in your Django project
2-use it on a specific page open this page on the browser
2- press F12(go to developer tools ) you will see it doesnot loading
Setup Information (please complete the following information):

  • OS: [e.g. Windows 10]
  • Browser [e.g. chrome, safari]
  • Browser version [e.g. 22]
  • Python version [e.g. 3.7]
  • Django version [e.g. 2.1]

How can I change months to spanish

It is very easy to setup and have it working. I just need to change month from English (December) to spanish: Diciembre.

Setup Information (please complete the following information):

  • OS: Windows 10 Pro
  • Firefox 71 64 Bits
  • Python version 3.6 x64
  • Django version 2.1

Upgrade to flatpickr 4.6.x?

This project currently includes flatpickr 4.5.2. There is newer release of flatpickr, in the 4.6.x range.
Please update the flatpickr dependency.

ModuleNotFoundError: No module named 'flatpickr'

Describe the problem
I have installed django-flatpickr as described in the installation instructions, and it works correctly in my Wagtail CMS project. When I use flatpickr in a model file, I use the documented import syntax:

from flatpickr import DatePickerInput

However, my IDE (VS Code) keeps complaining:

Unable to import 'django_flatpickr'pylint(import-error)

Likewise, when trying to run the Django shell, I get the following error:

$ python manage.py shell
...
ModuleNotFoundError: No module named 'flatpickr'

Expected behavior
I would hope that the IDE would be able to find the flatpickr import and that I would be able to run a Django shell.

Add support for pydantic@2

Describe the bug
Currently, the project is based on pydantic@1, when there is pydantic@2

poetry add django-flatpickr

Because django-flatpickr (2.0.1) depends on pydantic (<2)
and no versions of django-flatpickr match >2.0.1,<3.0.0, django-flatpickr (>=2.0.1,<3.0.0) requires pydantic (<2).
So, because project depends on both pydantic (^2.1.1) and django-flatpickr (^2.0.1), version solving failed.

How to clear the input

Once you enter a date, there is no way to clear the input.

It would be nice to include a button before of after the input to clear it.

I have tried adding this with javascript but it does not seem to truly clear the input.

Month Dropdown (List) is not showing on Django Flat Picker

Hey everyone,

I'm trying to use Django-FlatPickr in my Django project. I managed to configure all the options except for the Month List which is displayed on the header of Datetime Picker

I tried to set the [ 'monthSelectorType': 'dropdown' ] property but that didn't help!

Can you please provide any solution?

Setup Information

  • OS: macOS | FreeBSD Unix
  • Browser: Apple Safari | Google Chrom
  • Python version: 3.8
  • Django version: 3.1
  • Django-FlatPickr version: Latest from GitHub

Can not integrate Date widget to Django User Sign Up form.

Describe the problem
Calendar widget is not displaying when I click on a date field,

To Reproduce
forms.py

class CustomUserCreationForm(UserCreationForm):
    class Meta(UserCreationForm.Meta):
        model = CustomUser
        fields = ('first_name', 'last_name', 'date_of_birth', 'email')
        widgets = {
            'date_of_birth': DatePickerInput(),
        }

template

{% extends 'base.html' %}
{% block title %}Sign Up{% endblock %}
{% block extra_css %}
    {{ form.media.css }}
{% endblock %}
{% block extra_js %}
    {{ form.media.js }}
{% endblock %}
{% block content %}
    <h2>Sign up</h2>
    <form method="post">
        {% csrf_token %}
        {{ form.as_p }}
        <button type="submit">Sign up</button>
    </form>
{% endblock %}

Expected behavior
The calendar should be displayed when I click on a date field.

Console errors

  • No error on django console.
  • No error on JavaScript console.

Setup Information

  • Python version 3.7
  • Django version 2.2

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.