Opened 9 years ago
Last modified 9 years ago
#26215 closed Bug
if dumpdata FloatRangeField and IntegerRangeField values = "None" and post loaddata is ValidationError — at Version 1
Reported by: | Алексей | Owned by: | nobody |
---|---|---|---|
Component: | contrib.postgres | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Алексей | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
- FloatRangeField db data == None
- ./manage dumpdata
- ./manage loaddata
Conversion problem. accept string u'None' to float type
Track:
File "/local/lib/python2.7/site-packages/django/db/models/fields/init.py", line 1803, in to_python
params={'value': value},
Decision:
def to_python(self, value): if value == u'None': return None elif value is None: return value try: return float(value) except (TypeError, ValueError): raise exceptions.ValidationError( self.error_messages['invalid'], code='invalid', params={'value': value}, )
And IntegerField too
Source data dump example:
<field name="rate" type="FloatRangeField">{"upper": "None", "lower": "1.45", "bounds": "[)"}</field>
Note:
See TracTickets
for help on using tickets.