Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12550 closed (fixed)

DecimalField with null=True causes exception in admin list

Reported by: Jacques Beaurain <jacques.beaurain@…> Owned by: Brian Rosner
Component: contrib.admin Version: 1.2-alpha
Severity: Keywords:
Cc: jacques.beaurain@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Tracked it down to a regression introduce by changes for ticket #7980.

This is the exception:

TypeError: float() argument must be a string or a number

Note that this only happens if a record in the results contains a null in this field.
Patch attached.

Attachments (3)

django1.2nulldecimal.patch (727 bytes) - added by Jacques Beaurain <jacques.beaurain@…> 7 years ago.
Patch fixes exception
django_nullvalue_adminlist_display.patch (2.5 KB) - added by Jacques Beaurain <jacques.beaurain@…> 7 years ago.
Patch for other fields too and includes regression test.
django_nullvalue_adminlist_display.2.patch (3.4 KB) - added by Jacques Beaurain <jacques.beaurain@…> 7 years ago.
Better patch for flatchoices and one more type

Download all attachments as: .zip

Change History (10)

Changed 7 years ago by Jacques Beaurain <jacques.beaurain@…>

Attachment: django1.2nulldecimal.patch added

Patch fixes exception

comment:1 Changed 7 years ago by Karen Tracey

Needs tests: set

comment:2 Changed 7 years ago by Jacques Beaurain <jacques.beaurain@…>

Cc: jacques.beaurain@… added

Changed 7 years ago by Jacques Beaurain <jacques.beaurain@…>

Patch for other fields too and includes regression test.

comment:3 Changed 7 years ago by Jacques Beaurain <jacques.beaurain@…>

Needs tests: unset

comment:4 Changed 7 years ago by Jannis Leidel

Actually this looks more like a regression after the admin-readonly stuff in [11965].

Changed 7 years ago by Jacques Beaurain <jacques.beaurain@…>

Better patch for flatchoices and one more type

comment:5 Changed 7 years ago by Brian Rosner

Owner: changed from nobody to Brian Rosner
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:6 Changed 7 years ago by Brian Rosner

Resolution: fixed
Status: assignedclosed

(In [12148]) Fixed #12550 -- better handling with choices and null fields when displaying read-only values

Thanks Jacques Beaurain for the report and patch.

comment:7 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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