Django-autocomplete-light: ModelSelect2Multiple broken in 3.2.3 for createview

Created on 17 Apr 2017  路  8Comments  路  Source: yourlabs/django-autocomplete-light

I have a model with a ManyToManyField.
And a ModelForm which overwrites the widget for the field and sets it to ModelSelect2Multiple.
And then I show that form in the class based createview or updateview.
It worked (and works) perfectly in 3.2.1, but after I updated to 3.2.3 it now shows no widget on createview and on updateview it only shows the widget if the field already has a value.

Most helpful comment

Since it supposedly gets fixed in the next django release I dont assume you will do anything about it, but maybe you can suggest a temporary work-around?

Note Django 1.11 is an LTS version (extended support until at least April 2020) and is the last one to support Python 2 - hence it is expected this version will be used extensively.

*EDIT: actually this will be fixed in the next bugfix release of Django 1.11.x, so indeed likely no need to change DAL's code...

All 8 comments

Thanks for your feedback !

Does it work as you expect with 3.2.2 ?

If so, then perhaps it's related to #826 ?

3.2.2 is also broken.

K, about that, what you say "broken", and here you say " it now shows no widget on createview and on updateview it only shows the widget if the field already has a value."

I really need a lot more information to understand what's going on.

The best is if you reproduce your issue in a test project.

Otherwise, please try to follow guidelines: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

We need django and python versions, plus all relevant code.

<3

I investigated some more and it appears to be a combination of several things:

  1. I render the ModelSelect2Multiple field using django-widget-tweaks.
  2. In Django 1.11 a change was made that makes an empty select evaluate to False.
    That change is being reverted in the next django update.
  3. #826 presumably triggers this changed behavior which caused django-widget-tweaks to fail.

Since it supposedly gets fixed in the next django release I dont assume you will do anything about it, but maybe you can suggest a temporary work-around?

Since it supposedly gets fixed in the next django release I dont assume you will do anything about it, but maybe you can suggest a temporary work-around?

Note Django 1.11 is an LTS version (extended support until at least April 2020) and is the last one to support Python 2 - hence it is expected this version will be used extensively.

*EDIT: actually this will be fixed in the next bugfix release of Django 1.11.x, so indeed likely no need to change DAL's code...

Awesome, thanks a heap for the research !

@beruic could we revert #826 until the next Django 1.11 is released ? Please answer because probably nobody wants to revert your change even temporarily without your prior feedback <3

For my sake it's OK as long as you leave v 3.2.4 that has the fix on Pypi. That's the version we are using now, which works flawlessly for our needs.

When you do, please make an issue for reapplying the PR and ping me in it such that I can follow when the change returns.

Thanks @beruic ! @cfblaeb, @SaeX, if you're up for the task please open a PR.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrname picture mrname  路  9Comments

Senpos picture Senpos  路  5Comments

luzfcb picture luzfcb  路  6Comments

JMIdeaMaker picture JMIdeaMaker  路  3Comments

dotmobo picture dotmobo  路  7Comments