Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#12550 closed (fixed)

DecimalField with null=True causes exception in admin list

Reported by: Jacques Beaurain <jacques.beaurain@…> Owned by: brosner
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@…> 4 years ago.
Patch fixes exception
django_nullvalue_adminlist_display.patch (2.5 KB) - added by Jacques Beaurain <jacques.beaurain@…> 4 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@…> 4 years ago.
Better patch for flatchoices and one more type

Download all attachments as: .zip

Change History (10)

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

Patch fixes exception

comment:1 Changed 4 years ago by kmtracey

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

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

  • Cc jacques.beaurain@… added

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

Patch for other fields too and includes regression test.

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

  • Needs tests unset

comment:4 Changed 4 years ago by jezdez

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

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

Better patch for flatchoices and one more type

comment:5 Changed 4 years ago by brosner

  • Owner changed from nobody to brosner
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:6 Changed 4 years ago by brosner

  • Resolution set to fixed
  • Status changed from assigned to closed

(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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.