Opened 9 years ago

Closed 7 years ago

#1124 closed defect (worksforme)

admin interface FloatField validator raise "TypeError" when exceeding decimal_places

Reported by: emanuele.olivetti@… Owned by: adrian
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: UI/UX:


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:
Exception Type: 	TypeError
Exception Value: 	not all arguments converted during string formatting
Exception Location: 	/usr/local/lib/python2.4/site-packages/django/core/ 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.


Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by dcf

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

comment:2 Changed 7 years ago by Simon G. <dev@…>

  • Resolution set to worksforme
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.