Skip to content

Conversation

mx-moth
Copy link

@mx-moth mx-moth commented Jan 21, 2020

Three changes that complement each other

  • Allow customizing blank value in QuerySelectField

  • Show blank option in QuerySelectField if nothing is selected

    Otherwise the first option is effectively the default. If users don't
    change anything, or don't notice the select, then the first option will
    be automatically selected.

  • Set default "Select..." text for QuerySelectField.blank_label

@mx-moth mx-moth mentioned this pull request Jan 21, 2020
@mx-moth mx-moth force-pushed the queryselectfield-blank-label branch from ecb4fc6 to 3b387af Compare February 6, 2020 23:26
@mx-moth
Copy link
Author

mx-moth commented Feb 6, 2020

Pushed a fix for the broken test.

For reference, the behaviour of having an empty choice as the first option if there is no default is how Django operates. You can read about it in the Django ModelChoiceField docs, and the code where they trigger this behaviour is in ModelChoiceField.__init__

@mx-moth mx-moth force-pushed the queryselectfield-blank-label branch from 3b387af to c2af930 Compare February 6, 2020 23:42
Tim Heap added 4 commits February 7, 2020 11:41
Otherwise the first option is effectively the default. If users don't
change anything, or don't notice the select, then the first option will
be automatically selected.
@mx-moth mx-moth force-pushed the queryselectfield-blank-label branch from c2af930 to 05d133c Compare February 7, 2020 00:42
@mlenzen
Copy link
Owner

mlenzen commented Feb 24, 2020

@timheap I'm a maintainer of the official wtforms-sqlalchemy project now. Can you move your PRs there.

@mx-moth mx-moth closed this Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants