Skip to content

Conversation

@jnovinger
Copy link
Member

@jnovinger jnovinger commented Mar 18, 2025

Fixes: #18944

I don't love this fix since the feedback to the user is pretty bad--it just resets the form to defaults without explaining what happened. I didn't find an easy way to include an error message for the 'Widget type' field on GET (so that it might show in the UI) but that may just be me missing something.

I also took a quick look at our DynamicTomSelect code and didn't see an immediate way to fix this there.

Either way, I think it's worth getting at least this fix in for the time being to remove a potentially very visible 500 error for users with better user feedback in a follow up fix. But, I'm open to other options. Thoughts?

@jnovinger jnovinger requested review from a team and jeremystretch and removed request for a team March 18, 2025 21:05
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the right approach, but we can clean it up a bit by just ensuring that the initial value for the widget_class form field is always set to 'extras.NoteWidget' if not defined. We could change lines 1101-1103 to something like:

initial = {
    'widget_class': request.GET.get('widget_class') or 'extras.NoteWidget',
}

FWIW we should probably eliminate the "clear" button on required choice fields; I'll open a separate issue for that. (Edit: #18955)

@jnovinger jnovinger requested a review from jeremystretch March 19, 2025 17:19
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jnovinger!

@jeremystretch jeremystretch merged commit f07e2dd into main Mar 20, 2025
6 checks passed
@jeremystretch jeremystretch deleted the 18944-clearing-widget-type-valueerror branch March 20, 2025 13:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clearing "Widget type" field produces a ValueError: Unregistered widget class:

3 participants