django-suit icon indicating copy to clipboard operation
django-suit copied to clipboard

Inline returning false positive in formIsDirty

Open emilioidk opened this issue 7 years ago • 3 comments

Django version: 1.11.5 django-suit version: 0.2.26 Python version: 2.7.2

I have noticed that if a model has an inline with a select element, then if the inline is displayed, the system will display a "Changes you made may not be saved" warning before unloading the page, regardless of any form being dirty or not. This is because there is an empty row in the inline with the select (will happen if it is a "select one" or "select multiple" type) which will have the first element selected, but none of the elements will be "defaultSelected".

Do I understand right that the rows with class "empty-form" should not be analyzed to determine whether a form is dirty or not?

emilioidk avatar May 02 '18 19:05 emilioidk

Running into the same issue, it would be great to get this fixed :)

jwilliams-ecometrica avatar Jul 06 '18 10:07 jwilliams-ecometrica

Hey @jwilliams-ecometrica I have provided a fixed that worked for me. Would you mind giving it a try to see if it solves the issue in your environment?

The fork is here https://github.com/emilioidk/django-suit, you can add it to your requirements.txt as

-e git+git://github.com/emilioidk/django-suit@master#egg=django-suit

emilioidk avatar Jul 06 '18 11:07 emilioidk

Hi @emilioidk ,

No problem!

I just tested your fork and it seems to be working :)

jwilliams-ecometrica avatar Jul 06 '18 13:07 jwilliams-ecometrica