Opened 10 years ago

Last modified 10 years ago

#23320 closed Cleanup/optimization

FloatField not converting values to float() — at Initial Version

Reported by: Patrick Robetson Owned by: nobody
Component: Database layer (models, ORM) Version: 1.7-rc-2
Severity: Normal Keywords:
Cc: cmawebsite@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Apologies for creating an issue if this is the expected behaviour (FWIW there were no ideas on IRC):

Is the behaviour outlined in this snippet expected:
https://dpaste.de/BAck

I'd have expected the FloatField to convert values to a float in the return object as well (I can verify that the to_python method is being run, because the number is saved to the database correctly.

Is the recommended way of solving this to subclass FloatField and use?

class MyFloatField(with_metaclass(models.SubBaseField, models.FloadField)):
   ...

Change History (0)

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