fix: Allow additional draft forms to be added to IPR disclosure edit form#4952
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4952 +/- ##
=======================================
Coverage 88.47% 88.47%
=======================================
Files 296 296
Lines 39805 39814 +9
=======================================
+ Hits 35219 35227 +8
- Misses 4586 4587 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
rjsparks
approved these changes
Jan 6, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Together with #4951, fixes some major breakage on the IPR disclosure edit view.
Adding a new draft form to the formset was broken because of a missing call to
setupSelect2Field()after adding the fields to the DOM. This adds that call.In addition to the completely broken Django validation fixed by #4951, submitting the form failed because the JS was incorrectly numbering the formset entries it added when clicking the "Add more" button. This was happening because the
details_edit.htmltemplate rendered a blank formset for the javascript to duplicate by tagging the "extra" formset form with thetemplateclass. This PR fixes this by getting rid of the extra form hack and using theempty_formprovided by Django's formset class instead.