Opened 18 years ago

Closed 17 years ago

#4332 closed (wontfix)

IsRequired validation should strip whitespace

Reported by: nslater@… Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django's form validation should strip whitespace before testing if the field was empty.

Change History (5)

comment:1 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedDesign decision needed

Perhaps... I'm not convinced.

comment:2 by nslater@…, 17 years ago

Okay, lets say you have a form for users to update the User model. Let's say registering.

Does it make sense to allow the user to input " " as the username and have this pass validation?

comment:3 by Chris Beaven, 17 years ago

I get the reasoning, it just feels a bit too "magic".

While I can't think of any cases you would want to accept just whitespace in a field (and if there are any, they are fringe cases and could probably have a custom validator) it just sat a bit uneasy.

We'll let a core developer decide.

comment:4 by Brian Rosner <brosner@…>, 17 years ago

I am -1 on this. I feel that a web framework should not alter any data. There is really no reason why Django should do this for you as opposed to provide you with mechanisms to handle the validation yourself. If I have a description field that may except HTML and it is required then I would not want any whitespace removed.

comment:5 by Russell Keith-Magee, 17 years ago

Resolution: wontfix
Status: newclosed

I agree with SmileyChirs - this smells a bit too much like magic. If you want to strip whitespace, you can easily do it in a form clean method.

Note: See TracTickets for help on using tickets.
Back to Top