darklow / django-suit

Modern theme for Django admin interface
http://djangosuit.com/
Other
2.31k stars 701 forks source link

Inline returning false positive in formIsDirty #680

Open emilioidk opened 6 years ago

emilioidk commented 6 years ago

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?

jwilliams-ecometrica commented 6 years ago

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

emilioidk commented 6 years ago

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
jwilliams-ecometrica commented 6 years ago

Hi @emilioidk ,

No problem!

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