jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.11k stars 348 forks source link

Fix bogue when adding a new formset with horizontal=True #225

Closed erozqba closed 6 years ago

erozqba commented 7 years ago

This fixes a bug when adding new formset (that use horizontal=True) using javascript (when you click the link add another...) after the page is loaded.

To verify the bug:

  1. Install this branch locally and remove the modifications I have made in the file smart_selects/static/smart-selects/admin/js/bindfields.js
  2. Go to http://127.0.0.1:8000/admin/test_app/person/ and add at least two persons
  3. Go to http://127.0.0.1:8000/admin/test_app/talent/ and add at least two talents and select differents persons that have the talent you are adding.
  4. Go to http://127.0.0.1:8000/admin/test_app/group/add/ for adding a group, here try to add more than one person with talent in the membership, the current loaded inline should work as expected, but when you add a new inline using the link Add another Membership the new ones should not work as expected.

The steps to verify the fix are:

  1. Apply the changes I have made in the smart_selects/static/smart-selects/admin/js/bindfields.js

Ref: issue #210

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.9%) to 89.565% when pulling 10687cc68818f7484c88b6f10b80b45fc7493b1e on erozqba:adding_formset_horizontal_true into ae906b95d3f8e770a7d84ee59ff53ebb1e53b883 on digi604:master.

blag commented 6 years ago

Thanks!