django-smart-selects
django-smart-selects copied to clipboard
Ignore fields with __prefix__ in id
django-smart-selects is currently initialising fields that aren't displayed on screen (including __prefix__ in the id)
https://docs.djangoproject.com/en/3.2/topics/forms/formsets/#empty-form
These are usually created for one/many-to-many relationships, and are cloned when a user clicks on the "add another" within the admin. The __prefix__ is then replaced with an index number (starting at 0)
There is a lot of code spread around to skip fields that include __prefix__:
https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/contrib/admin/static/admin/js/SelectFilter2.js#L11-L14
https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/contrib/admin/static/admin/js/autocomplete.js#L33
Codecov Report
Merging #332 (ed45b07) into master (2cff847) will not change coverage. The diff coverage is
n/a.
@@ Coverage Diff @@
## master #332 +/- ##
=======================================
Coverage 80.42% 80.42%
=======================================
Files 8 8
Lines 470 470
Branches 68 68
=======================================
Hits 378 378
Misses 60 60
Partials 32 32
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 2cff847...ed45b07. Read the comment docs.