Enable admin users to edit benefits from sponsorship application via django admin #1710
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.
My strategy with this PR is to change the default model form used by
SponsorBenefitInline
by a custom one. The new form has only two fields, one to pick the sponsorship benefit and another to select the internal value for the sponsor benefit. The form differs creation vs update operation and there are unit tests covering these operations.@ewdurbin here's how the inline forms are looking like now:
This PR also adds permissions control on this inline as well. To keep it simple, I did this by implementing a property to flag if the sponsorship is or isn't open for changes. For now if an application was approved or rejected, it can't be edited anymore. I think this plus an admin action to roll back the sponsorship to an "editable" state makes the internal's state control more solid and less prune to errors.
Once this PR gets merged into master, we can update this logic in #1702 because, let's imagine we want to edit an approved sponsorship which already has a draft version for the statement of work. There are more operations needed in this scenario (delete the SoW for example) that I think we have to talk about.