Opened 11 years ago

Closed 11 years ago

#20298 closed Uncategorized (duplicate)

Forms - FloatField and IntegerField raise errors when a user enters space in textboxes.

Reported by: krishna@… Owned by: nobody
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When a user keys in few spaces in a FloatField or IntegerField. Django fails to treat them as empty and tries to convert them to float and int respectively, leading to an unnecessary validation error. Users need to define custom fields and custom clean methods currently to overcome this issue.

Stripping the value prior to conversion will solve the problem. I have submitted a pull reqhest here -
https://github.com/django/django/pull/1023

I have also attached the patch to this ticket.

Attachments (1)

fields.patch (844 bytes ) - added by krishna@… 11 years ago.
Strips the value before checking for emptiness in case of FloatField and IntegerField

Download all attachments as: .zip

Change History (2)

by krishna@…, 11 years ago

Attachment: fields.patch added

Strips the value before checking for emptiness in case of FloatField and IntegerField

comment:1 by Jacob, 11 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #18761 (which addresses the real issue, namely that Django's really inconsistent about where it strips and where it won't).

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