Services Blog Fran├žais

django-autocomplete-light 3.8.0 release

| by jpic | django-autocomplete-light python django

WARNING 3.8.0 did not contain the proper built JS, please use 3.8.1 that was just released.

Django-autocomplete-light 3.8.0 was released, and features all your contributions of the year, and tested with a pre-release for the last 3 months or so.

It promises to fix all your JS loading issues, but comes at the price of a small backward compatibility breaks affecting users with custom init functions. If unsure: you probably don’t have any and the upgrade should just work for you.

As you will see, this is a pretty big release, we’ll also briefly talk about the future of django-autocomplete-light in this post.

The whole media/script story should have been fixed by @danielmorrel ! But this comes with a price to pay: you now need to register your init functions

Backward compatibility break

If you don’t have custom javascript functions then you have nothing to do.

If you have custom javascript functions you need to register your function so that it works in 3.8.0, change your init code to something like:

document.addEventListener('dal-init-function', function () {
    yl.registerFunction( 'your_autocomplete_function', function ($, element) {
        var $element = $(element);
        // autocomplete function here
    });
})

Read more in documentation

Changelog

Wait, where are 3.6.0 and 3.7.0 ?

Well, Pypi won’t let me upload there, it says:

HTTPError: 400 Client Error: This filename has already been used, use a different version. See https://pypi.org/help/#file-name-reuse for more information. for url: https://upload.pypi.org/legacy/

But I only see 3.6.0.dev0 and 3.6.0.dev1 and 3.7.0.dev0, I suppose I should have done pre-releases on 3.6.dev0 and 3.7.dev0.

Anyway, it lets me upload on 3.8.0, one of the last 3.x medium releases !

But don’t worry, 4.0 will not break anything, it will merely add a new autocomplete script for people who want out of select2 or want something more like what we had in DAL 1 & 2 Demo Source

The input will have your input design by default (because Shadow Root is not activated on this component).

Other reasons why shadow root is not enabled yet:

  • I didn’t know all available features of CSS variables when I started the PoC
  • I kind of remember that Shadow Root prevented plain form POST from working, but I’m not so sure about that and I can still try again ;)

You can test it in the alight branch of the django-autocomplete-light repository.

For those who remember, this solves exactly the same problems that jquery-autocomplete-light did, except it’s a lightweight StencilJS WebComponent now, as such, we won’t have any initialization code for that (it’s done by the browser).

So, you will be able to use that to get a nice global navigation search in the top bar in again, with server side rendering.

Thanks

Thank you deeply to all contributors, I mean, I’m still shocked to read that some users have just upgraded from 2.x to 3.x, does that mean they’ve had the jquery-autocomplete-light script in production for potentially 8 years ?

It’s mind blowing, you are amazing !

They trust us

Contact