Opened 18 years ago

Closed 17 years ago

#1124 closed defect (worksforme)

admin interface FloatField validator raise "TypeError" when exceeding decimal_places

Reported by: emanuele.olivetti@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Unexpected behaviour in admin interface. If I specify a given number of decimal_places in FloatField:

  ....(snippet from my model)...
  quantita = meta.FloatField("Quantita",max_digits=10,decimal_places=2,core=True)
  ....

and I try to insert more figures than 2 after the dot (e.g. "1.2345") , I got a TypeError:


Request Method:  	POST
Request URL: 	http://127.0.0.1:8000/admin/koan/ddt/96/
Exception Type: 	TypeError
Exception Value: 	not all arguments converted during string formatting
Exception Location: 	/usr/local/lib/python2.4/site-packages/django/core/validators.py in __call__, line 354
...

This happens both for 0.90 and current svn revision.

The validator works correctly if I try to insert something different than a float number (e.g. "a" -> "Please correct the error below."), but fails, raising TypeError, when exceeding decimal_places. Which is definitely unexpected.

Emanuele

Change History (2)

comment:1 by dcf, 18 years ago

Works for me on trunk. Though i only see the validation error message if edit_inline=meta.STACKED

comment:2 by Simon G. <dev@…>, 17 years ago

Resolution: worksforme
Status: newclosed

Marked as worksforme as I'm unable to replicate this in the current svn (4400). I'm guessing that this has been fixed.

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