WIP EditTable get_received_rows_data() and get_row_pk_for_choices() #660
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.
this PR is open for suggestions/changes
I don't really like the method names nor really the code, since it's quite similar to things inside
edit_table__post_handler. But refactoring the code might be a "one day in the future" taskWe need to be able inside
choicesto get the current data of edit table, so we can offer only choices that aren't already selected.E.g. you have a nested form of a Project + EditTable for team of people working on it, so people shouldn't be selectable twice.
So with this methods I could do something like
I'm having one issue tho - it works for new rows, but not for the existing ones... existing rows get
Person.objects.all()for some reason. I'm guessingedit_formdoesn't reload choices inbind_field_from_instanceBtw this should be possible to use also inside
initialfor default values of a new row