Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember FlexibleImageWidget choice on form redisplay #3681

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d85dadb
Bind CIV value on MultipleCIVForm redisplay
ammar257ammar Oct 31, 2024
a2f1f67
Fix handling of image CIV value on form redisplay
ammar257ammar Oct 31, 2024
44c478d
Rename variables
ammar257ammar Oct 31, 2024
8c4c69e
Rename variables in image widget template
ammar257ammar Oct 31, 2024
c5db5e5
clean condition
ammar257ammar Oct 31, 2024
3de2e16
Add title to Image and UserUpload to unify access object name
ammar257ammar Nov 2, 2024
a501081
Add hidden input field with current value on form redisplay submission
ammar257ammar Nov 2, 2024
745564f
Clean the implementation
ammar257ammar Nov 2, 2024
1f134f2
Fix failing test
ammar257ammar Nov 2, 2024
194a715
Update comment
ammar257ammar Nov 4, 2024
d821df6
Use get() got Image and UserUpload
ammar257ammar Nov 4, 2024
20c2731
Raise RuntimeError if image pk is unknown
ammar257ammar Nov 4, 2024
833c47a
Add WidgetChoice for selected image for semantic consistency
ammar257ammar Nov 4, 2024
a920391
extend image widget test with IMAGE_SELECTED case
ammar257ammar Nov 4, 2024
298966c
Remember submitted value of dynamically added interfaces
ammar257ammar Nov 5, 2024
8eb0b65
Keep the original value when empty value is submitted
ammar257ammar Nov 5, 2024
39c739b
Make sure a valid uuid is passed along
ammar257ammar Nov 5, 2024
b955ae0
test image widget populated value on update view validation error
ammar257ammar Nov 5, 2024
38c8618
Merge branch 'main' into 3558_FlexibleImageWidget_reset_on_form_valid…
ammar257ammar Nov 5, 2024
2964e30
pre-commit fix
ammar257ammar Nov 5, 2024
6cad29c
Update view test
ammar257ammar Nov 5, 2024
54d1e87
Update RuntimeError message
ammar257ammar Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/grandchallenge/components/form_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def get_image_field(self):
current_value = Image.objects.get(pk=self.initial)
elif UserUpload.objects.filter(pk=self.initial).exists():
current_value = UserUpload.objects.get(pk=self.initial)
elif self.initial:
ammar257ammar marked this conversation as resolved.
Show resolved Hide resolved
raise RuntimeError(f"Unknown image pk: {self.initial}")

self.kwargs["widget"] = FlexibleImageWidget(
help_text=self.help_text,
Expand Down