Skip to content

Resolve choices callables lazily - #939

Merged
azmeuk merged 1 commit into
pallets-eco:mainfrom
azmeuk:lazy-choices
Oct 22, 2026
Merged

azmeuk merged 1 commit into
pallets-eco:mainfrom
azmeuk:lazy-choices

Conversation

@azmeuk

@azmeuk azmeuk commented Oct 19, 2026

Copy link
Copy Markdown
Member

SelectField and DataList choices callables now run on the first read instead of during post_process. The result is cached until the next post_process. Running post_process again with the same formdata after a data change refreshes the choices.

SelectField and DataList choices callables now run on the first read
instead of during post_process. The result is cached until the next
post_process. Running post_process again with the same formdata after a
data change refreshes the choices.

Assigning a callable to field.choices replaces the constructor callable.
Assigning any other value drops it.

Passing a callable to SelectFieldBase._choices_from_input is deprecated.
@azmeuk
azmeuk merged commit 61a7614 into pallets-eco:main Oct 22, 2026
18 checks passed
@azmeuk
azmeuk deleted the lazy-choices branch October 22, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant