Add "strip" keyword argument to CharField constructor
|Reported by:||tzellman@…||Owned by:||nobody|
|Cc:||hv@…, marti@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
I am suggesting that a strip keyword (or something similar) gets added to the CharField constructor in newforms/fields.py.
This would allow for certain fields to get stripped before being cleaned.
Example: Assume you have a CharField with min_length set to 3. Typing in 3 spaces will be valid, which in some cases is fine. But other times, you want to strip the whitespace. This way, a field filled with spaces will be considered to be empty, if the "strip" argument is True.
This is only a suggestion, but it would be nice to have. I know that I could easily sub-class and create my own "StrippedCharField", and that might be the right way to go, but I thought this might be a common issue for other people as well.
Change History (8)
Changed 8 years ago by tzellman@…
comment:1 Changed 8 years ago by tzellman@…
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 8 years ago by Simon G. <dev@…>
- Triage Stage changed from Unreviewed to Design decision needed
comment:5 Changed 2 years ago by intgr
- Cc marti@… added
- Easy pickings unset
- Severity set to Normal
- Type set to Uncategorized
- UI/UX unset
comment:6 Changed 3 weeks ago by timgraham
- Patch needs improvement set
- Triage Stage changed from Design decision needed to Accepted
- Type changed from Uncategorized to New feature