django-advanced-filters icon indicating copy to clipboard operation
django-advanced-filters copied to clipboard

Datepicker doesn't seem to work on Django 1.6

Open JVanloofsvelt opened this issue 9 years ago • 5 comments

From the console: TypeError: $(...).datepicker is not a function

JVanloofsvelt avatar Aug 02 '16 08:08 JVanloofsvelt

Hi @elJorno,

Thank you for showing interest in django-advanced-filters and for reporting the issue!

datepicker is a component of jQuery UI. The plugin should be included if you use the django-grappelli package, but not necessarily if you don't.

This issue is somewhat similar to #2 , and you can refer to this comment for details on customizing the template and frontend behavior to your needs. Alas, toggling grappelli requirement easily is still on our TODO list.

A potential solution specific to the datepicker widget requirement, would be to default to an <input type="date"> element for the date range field value input. This will render a nice widget in Chrome and Opera, and should fallback to a simple text input on other browsers.

Thanks again, and we welcome PRs if you feel like contributing 😊

asfaltboy avatar Aug 19 '16 15:08 asfaltboy

Hi @asfaltboy, thanks for your reply. I was just exploring your app but I will not be using it. If I were I might attempt to contribute (that'd be new for me :) ).

Kind regards

JVanloofsvelt avatar Aug 19 '16 15:08 JVanloofsvelt

Same problem with Django 1.8, Django CMS and Django CMS Admin Style (no Grappelli).

nkonin avatar Mar 01 '17 11:03 nkonin

It seems date range doesn't work at all without grappelli

https://github.com/modlinltd/django-advanced-filters/blob/1.0.5/advanced_filters/static/advanced-filters/advanced-filters.js#L40

nkonin avatar Mar 01 '17 12:03 nkonin

Hi @nkonin , thank you for your interest in django-advanced-filters. Yes, you are correct that grappelli is currently required to use the mentioned widget.

I guess we have a few options at this time:

  • Explicitly include [jQuery UI datepicker][1] and use only it in our default template.
  • Use django's AdminDateWidget/AdminTimeWidget implementation
  • Detect existing UI overhaul (e.g Grappelli) and use the included code from them

Pull requests are welcome

asfaltboy avatar Mar 01 '17 13:03 asfaltboy